Skip to content

Commit

Permalink
Merge pull request #421 from qonversion/release/5.4.0
Browse files Browse the repository at this point in the history
Release 5.4.0
  • Loading branch information
suriksarkisyan authored Nov 27, 2023
2 parents 9bc810d + f3f64cb commit d952858
Show file tree
Hide file tree
Showing 16 changed files with 250 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Framework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>5.3.0</string>
<string>5.4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
1 change: 1 addition & 0 deletions Framework/QonversionFramework.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#import <Qonversion/QONExperiment.h>
#import <Qonversion/QONExperimentGroup.h>
#import <Qonversion/QONRemoteConfigurationSource.h>
#import <Qonversion/QONSubscriptionPeriod.h>
#import <Qonversion/QONRemoteConfig.h>
#import <Qonversion/QONUserProperty.h>
#import <Qonversion/QONUserProperties.h>
Expand Down
2 changes: 1 addition & 1 deletion Qonversion.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Pod::Spec.new do |s|
idfa_exclude_files = ['Sources/Qonversion/IDFA']
s.name = 'Qonversion'
s.swift_version = '5.5'
s.version = '5.3.0'
s.version = '5.4.0'
s.summary = 'qonversion.io'
s.description = <<-DESC
Deep Analytics for iOS Subscriptions
Expand Down
32 changes: 22 additions & 10 deletions Qonversion.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
6A95DEA229E40E9900350BD6 /* QNOutagerIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A95DEA129E40E9900350BD6 /* QNOutagerIntegrationTests.m */; };
6A95DEA529E40F2E00350BD6 /* XCTestCase+Helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A95DEA429E40F2E00350BD6 /* XCTestCase+Helpers.m */; };
700EC173291277130032E205 /* QONExperimentGroup+Protected.h in Headers */ = {isa = PBXBuildFile; fileRef = 700EC171291277130032E205 /* QONExperimentGroup+Protected.h */; };
701922272B0B812400724926 /* Qonversion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 459DAB69243E329F0011ECF3 /* Qonversion.framework */; };
701922282B0B812400724926 /* Qonversion.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 459DAB69243E329F0011ECF3 /* Qonversion.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
701922732B10981200724926 /* QONSubscriptionPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = 701922712B10981200724926 /* QONSubscriptionPeriod.h */; settings = {ATTRIBUTES = (Public, ); }; };
701922742B10981200724926 /* QONSubscriptionPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = 701922722B10981200724926 /* QONSubscriptionPeriod.m */; };
701922762B10AB3300724926 /* QONSubscriptionPeriod+Protected.h in Headers */ = {isa = PBXBuildFile; fileRef = 701922752B10AB3300724926 /* QONSubscriptionPeriod+Protected.h */; };
701922812B10DF2200724926 /* Qonversion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 459DAB69243E329F0011ECF3 /* Qonversion.framework */; };
701922822B10DF2200724926 /* Qonversion.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 459DAB69243E329F0011ECF3 /* Qonversion.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
702394912923EBF3003126D5 /* QONNotificationsService.h in Headers */ = {isa = PBXBuildFile; fileRef = 7023948F2923EBF3003126D5 /* QONNotificationsService.h */; };
702394922923EBF3003126D5 /* QONNotificationsService.m in Sources */ = {isa = PBXBuildFile; fileRef = 702394902923EBF3003126D5 /* QONNotificationsService.m */; };
70283DF729F66FAC00D138BC /* PurchasesMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70283DF629F66FAC00D138BC /* PurchasesMapper.swift */; };
Expand Down Expand Up @@ -260,7 +263,7 @@
remoteGlobalIDString = 454EF63B24E5CC580070581E;
remoteInfo = Sample;
};
701922292B0B812400724926 /* PBXContainerItemProxy */ = {
701922832B10DF2200724926 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 459DAB60243E329F0011ECF3 /* Project object */;
proxyType = 1;
Expand All @@ -270,13 +273,13 @@
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
7019222B2B0B812400724926 /* Embed Frameworks */ = {
701922852B10DF2200724926 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
701922282B0B812400724926 /* Qonversion.framework in Embed Frameworks */,
701922822B10DF2200724926 /* Qonversion.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -348,6 +351,9 @@
6A95DEA329E40F2100350BD6 /* XCTestCase+Helpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "XCTestCase+Helpers.h"; sourceTree = "<group>"; };
6A95DEA429E40F2E00350BD6 /* XCTestCase+Helpers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "XCTestCase+Helpers.m"; sourceTree = "<group>"; };
700EC171291277130032E205 /* QONExperimentGroup+Protected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "QONExperimentGroup+Protected.h"; sourceTree = "<group>"; };
701922712B10981200724926 /* QONSubscriptionPeriod.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QONSubscriptionPeriod.h; sourceTree = "<group>"; };
701922722B10981200724926 /* QONSubscriptionPeriod.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QONSubscriptionPeriod.m; sourceTree = "<group>"; };
701922752B10AB3300724926 /* QONSubscriptionPeriod+Protected.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "QONSubscriptionPeriod+Protected.h"; sourceTree = "<group>"; };
7023948F2923EBF3003126D5 /* QONNotificationsService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QONNotificationsService.h; sourceTree = "<group>"; };
702394902923EBF3003126D5 /* QONNotificationsService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QONNotificationsService.m; sourceTree = "<group>"; };
70283DF629F66FAC00D138BC /* PurchasesMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurchasesMapper.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -540,7 +546,7 @@
files = (
45754AE725814C7500FCA376 /* iAd.framework in Frameworks */,
891ECE0B2773614600DF6A56 /* AdServices.framework in Frameworks */,
701922272B0B812400724926 /* Qonversion.framework in Frameworks */,
701922812B10DF2200724926 /* Qonversion.framework in Frameworks */,
70D9CBDF2B03BF07003F1878 /* StoreKit.framework in Frameworks */,
A2649CD29A7FDF280A2EC27C /* Pods_Sample.framework in Frameworks */,
);
Expand Down Expand Up @@ -960,6 +966,8 @@
895731DA26DD03A2009507A6 /* QONOffering.m */,
895731DB26DD03A2009507A6 /* QONActionResult.h */,
895731DC26DD03A2009507A6 /* QONProduct.m */,
701922712B10981200724926 /* QONSubscriptionPeriod.h */,
701922722B10981200724926 /* QONSubscriptionPeriod.m */,
70D0E2BA291AA21C004E8DE8 /* QONLaunchMode.h */,
70E99383291BC60A006E0A64 /* QONEnvironment.h */,
70D0E2B6291A9BE3004E8DE8 /* QONConfiguration.h */,
Expand Down Expand Up @@ -1313,6 +1321,7 @@
707734F62A9F6B8700CFF742 /* QONRemoteConfigurationSource+Protected.h */,
702DBDEB2A3216C900D590D0 /* QONExperiment+Protected.h */,
8957324226DD03A3009507A6 /* QONUser+Protected.h */,
701922752B10AB3300724926 /* QONSubscriptionPeriod+Protected.h */,
8957324326DD03A3009507A6 /* QONOfferings+Protected.h */,
8957324526DD03A3009507A6 /* QONOffering+Protected.h */,
8957324726DD03A3009507A6 /* QONIntroEligibility+Protected.h */,
Expand Down Expand Up @@ -1606,6 +1615,7 @@
895732FB26DD03A3009507A6 /* QNIdentityManager.h in Headers */,
895732C226DD03A3009507A6 /* QNInMemoryStorage.h in Headers */,
895732A326DD03A3009507A6 /* QONAutomationsEvent+Protected.h in Headers */,
701922732B10981200724926 /* QONSubscriptionPeriod.h in Headers */,
895732C126DD03A3009507A6 /* QNLocalStorage.h in Headers */,
707734F72A9F6B8700CFF742 /* QONRemoteConfigurationSource+Protected.h in Headers */,
700EC173291277130032E205 /* QONExperimentGroup+Protected.h in Headers */,
Expand All @@ -1624,6 +1634,7 @@
70ED951029FAAF31005F5D00 /* QONStoreKit2PurchaseModel.h in Headers */,
8957329126DD03A3009507A6 /* QONAutomations.h in Headers */,
895732ED26DD03A3009507A6 /* QNUserInfoMapper.h in Headers */,
701922762B10AB3300724926 /* QONSubscriptionPeriod+Protected.h in Headers */,
70ADE70F2951CC7200CB4D2E /* QONScreenPresentationConfiguration.h in Headers */,
8957327C26DD03A3009507A6 /* QONAutomationsDelegate.h in Headers */,
8957330126DD03A3009507A6 /* QNUserInfoServiceInterface.h in Headers */,
Expand Down Expand Up @@ -1664,12 +1675,12 @@
454EF63924E5CC580070581E /* Frameworks */,
454EF63A24E5CC580070581E /* Resources */,
4CB079286CCC86BD200EEDB0 /* [CP] Embed Pods Frameworks */,
7019222B2B0B812400724926 /* Embed Frameworks */,
701922852B10DF2200724926 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
7019222A2B0B812400724926 /* PBXTargetDependency */,
701922842B10DF2200724926 /* PBXTargetDependency */,
);
name = Sample;
productName = Sample;
Expand Down Expand Up @@ -1965,6 +1976,7 @@
895732A626DD03A3009507A6 /* QONAutomationsScreen.m in Sources */,
70ED951129FAAF31005F5D00 /* QONStoreKit2PurchaseModel.m in Sources */,
70EC019D29EEE94300E686E2 /* StoreKit2Service.swift in Sources */,
701922742B10981200724926 /* QONSubscriptionPeriod.m in Sources */,
895732A926DD03A3009507A6 /* QONAutomationsMapper.m in Sources */,
895732F226DD03A3009507A6 /* QNMapper.m in Sources */,
70D0E2B9291A9BE3004E8DE8 /* QONConfiguration.m in Sources */,
Expand Down Expand Up @@ -2068,10 +2080,10 @@
target = 454EF63B24E5CC580070581E /* Sample */;
targetProxy = 6A8A604C29DAD5CB008EC7D8 /* PBXContainerItemProxy */;
};
7019222A2B0B812400724926 /* PBXTargetDependency */ = {
701922842B10DF2200724926 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 459DAB68243E329F0011ECF3 /* Qonversion */;
targetProxy = 701922292B0B812400724926 /* PBXContainerItemProxy */;
targetProxy = 701922832B10DF2200724926 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

Expand Down
2 changes: 1 addition & 1 deletion Sources/Qonversion/Public/QONConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "QONConfiguration.h"
#import "QNAPIConstants.h"

static NSString *const kSDKVersion = @"5.3.0";
static NSString *const kSDKVersion = @"5.4.0";

@interface QONConfiguration ()

Expand Down
2 changes: 1 addition & 1 deletion Sources/Qonversion/Public/QONErrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef NS_ERROR_ENUM(QONErrorDomain, QONError) {
// user cancelled the request, etc.
QONErrorCancelled = 1,

// the product has not been added to the product center
// the product has not been added in Qonversion Dashboard
// see more https://qonversion.io/docs/create-products
QONErrorProductNotFound = 2,

Expand Down
19 changes: 16 additions & 3 deletions Sources/Qonversion/Public/QONProduct.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import <StoreKit/StoreKit.h>
#import "QONSubscriptionPeriod.h"

typedef NS_ENUM(NSInteger, QONProductType) {
QONProductTypeUnknown = -1,
Expand Down Expand Up @@ -67,15 +68,27 @@ NS_SWIFT_NAME(Qonversion.Product)
@property (nonatomic, assign) QONProductType type;

/**
Product duration
Product duration set via Qonversion Dashboard
@see [Products durations](https://qonversion.io/docs/create-products#product-type)
*/
@property (nonatomic, assign) QONProductDuration duration;
@property (nonatomic, assign) QONProductDuration duration DEPRECATED_MSG_ATTRIBUTE("Use subscriptionPeriod instead.");

/**
Product subscription period based on the Apple Store Product.
Returns nil if the product is not a subscription or the store product can't be loaded from the Storekit.
*/
@property (nonatomic, strong, nullable) QONSubscriptionPeriod *subscriptionPeriod API_AVAILABLE(ios(11.2), macosx(10.13.2), watchos(6.2), tvos(11.2));

/**
Product trial period based on the Apple Store Product.
Returns nil if the product is not a subscription, or trial is not available, or the store product can't be loaded from the Storekit.
*/
@property (nonatomic, strong, nullable) QONSubscriptionPeriod *trialPeriod API_AVAILABLE(ios(11.2), macosx(10.13.2), watchos(6.2), tvos(11.2));

/**
Trial duration
*/
@property (nonatomic, assign) QONTrialDuration trialDuration;
@property (nonatomic, assign) QONTrialDuration trialDuration DEPRECATED_MSG_ATTRIBUTE("Use trialPeriod instead.");

/**
Associated StoreKit Product
Expand Down
65 changes: 65 additions & 0 deletions Sources/Qonversion/Public/QONProduct.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "QONStoreKitSugare.h"
#import "QONProduct.h"
#import "QONSubscriptionPeriod+Protected.h"

@implementation QONProduct : NSObject

Expand All @@ -26,6 +27,18 @@ - (void)setSkProduct:(SKProduct *)skProduct {
_skProduct = skProduct;
}

- (QONSubscriptionPeriod *)trialPeriod {
if (_trialPeriod) {
return _trialPeriod;
}

if (self.skProduct.introductoryPrice) {
_trialPeriod = [[QONSubscriptionPeriod alloc] initWithStoreSubscriptionPeriod:self.skProduct.introductoryPrice.subscriptionPeriod];
}

return _trialPeriod;
}

- (QONTrialDuration)trialDuration {
if (_trialDuration) {
return _trialDuration;
Expand Down Expand Up @@ -93,15 +106,62 @@ - (QONTrialDuration)trialDuration {
return _trialDuration;
}

- (QONProductType)type {
if (_type) {
return _type;
}

if (!self.skProduct) {
return QONProductTypeUnknown;
}

QONProductType type = QONProductTypeUnknown;

if (@available(iOS 11.2, macOS 10.13.2, watchOS 6.2, tvOS 11.2, *)) {
if (self.skProduct.introductoryPrice && self.skProduct.introductoryPrice.paymentMode == SKProductDiscountPaymentModeFreeTrial) {
type = QONProductTypeTrial;
} else if (self.skProduct.subscriptionPeriod) {
type = QONProductTypeDirectSubscription;
} else {
type = QONProductTypeOneTime;
}
}

_type = type;

return _type;
}

- (QONSubscriptionPeriod *)subscriptionPeriod {
if (_subscriptionPeriod) {
return _subscriptionPeriod;
}

if (self.skProduct.subscriptionPeriod) {
_subscriptionPeriod = [[QONSubscriptionPeriod alloc] initWithStoreSubscriptionPeriod:self.skProduct.subscriptionPeriod];
}

return _subscriptionPeriod;
}

- (NSString *)description {
NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: ", NSStringFromClass([self class])];

[description appendFormat:@"id=%@,\n", self.qonversionID];
[description appendFormat:@"storeID=%@,\n", self.storeID];
[description appendFormat:@"offeringID=%@,\n", self.offeringID];
[description appendFormat:@"type=%@ (enum value = %li),\n", [self prettyType], (long) self.type];

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Warning muted for linter
[description appendFormat:@"duration=%@ (enum value = %li),\n", [self prettyDuration], (long) self.duration];
[description appendFormat:@"trial duration=%@ (enum value = %li),\n", [self prettyTrialDuration], (long) self.trialDuration];
#pragma GCC diagnostic pop
if (@available(iOS 11.2, macOS 10.13.2, watchOS 6.2, tvOS 11.2, *)) {
[description appendFormat:@"subscription period=%@, \n", self.subscriptionPeriod];
[description appendFormat:@"trial period=%@, \n", self.trialPeriod];
}
[description appendFormat:@"skProduct=%@,\n", self.skProduct];
[description appendString:@">"];

Expand All @@ -116,6 +176,9 @@ - (NSString *)prettyPrice {
return @"";
}

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Warning muted for linter
- (NSString *)prettyDuration {
NSString *result = @"unknown";

Expand Down Expand Up @@ -186,6 +249,8 @@ - (NSString *)prettyTrialDuration {
return result;
}

#pragma GCC diagnostic pop

- (NSString *)prettyType {
NSString *result = @"unknown";

Expand Down
32 changes: 32 additions & 0 deletions Sources/Qonversion/Public/QONSubscriptionPeriod.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// QONSubscriptionPeriod.h
// Qonversion
//
// Created by Suren Sarkisyan on 24.11.2023.
// Copyright © 2023 Qonversion Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSInteger, QONSubscriptionPeriodUnit) {
QONSubscriptionPeriodUnitDay = 0,
QONSubscriptionPeriodUnitWeek = 1,
QONSubscriptionPeriodUnitMonth = 2,
QONSubscriptionPeriodUnitYear = 3
} NS_SWIFT_NAME(Qonversion.SubscriptionPeriodUnit);

API_AVAILABLE(ios(11.2), macosx(10.13.2), watchos(6.2), tvos(11.2))
NS_SWIFT_NAME(Qonversion.SubscriptionPeriod)
@interface QONSubscriptionPeriod : NSObject

@property (nonatomic, assign) QONSubscriptionPeriodUnit unit;

@property (nonatomic, assign) NSUInteger unitCount;

+ (NSString *)unitStringFormat:(QONSubscriptionPeriodUnit)unit;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit d952858

Please sign in to comment.