diff --git a/Framework/Info.plist b/Framework/Info.plist index 132f358f..fb471fb5 100644 --- a/Framework/Info.plist +++ b/Framework/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 5.12.2 + 5.12.3 CFBundleSignature ???? CFBundleVersion diff --git a/IntegrationTests/QNAPIClientIntegrationTests.m b/IntegrationTests/QNAPIClientIntegrationTests.m index 1e6dbbd9..26c9fcfa 100644 --- a/IntegrationTests/QNAPIClientIntegrationTests.m +++ b/IntegrationTests/QNAPIClientIntegrationTests.m @@ -529,26 +529,6 @@ - (void)testIdentifyError { [self waitForExpectationsWithTimeout:self.kRequestTimeout handler:nil]; } -- (void)testSendPushToken { - // given - XCTestExpectation *completionExpectation = [self expectationWithDescription:@"Send push token call"]; - NSString *uid = [NSString stringWithFormat:@"%@%@", self.kUidPrefix, @"_sendPushToken"]; - QNAPIClient *client = [self getClient:uid]; - - // when - [client launchRequest:^(NSDictionary * _Nullable initRes, NSError * _Nullable createUserError) { - XCTAssertNil(createUserError); - - [client sendPushToken:^(BOOL success) { - XCTAssertFalse(success); // no push token on emulator - [completionExpectation fulfill]; - }]; - }]; - - // then - [self waitForExpectationsWithTimeout:self.kRequestTimeout handler:nil]; -} - - (void)testScreens { // given XCTestExpectation *completionExpectation = [self expectationWithDescription:@"Screens call"]; diff --git a/IntegrationTests/QNOutagerIntegrationTests.m b/IntegrationTests/QNOutagerIntegrationTests.m index 8e9dfa4c..cc9d50e1 100644 --- a/IntegrationTests/QNOutagerIntegrationTests.m +++ b/IntegrationTests/QNOutagerIntegrationTests.m @@ -329,26 +329,6 @@ - (void)testIdentify { [self waitForExpectationsWithTimeout:self.kRequestTimeout handler:nil]; } -- (void)testSendPushToken { - // given - XCTestExpectation *completionExpectation = [self expectationWithDescription:@"Send push token call"]; - NSString *uid = [NSString stringWithFormat:@"%@%@", self.kUidPrefix, @"_sendPushToken"]; - QNAPIClient *client = [self getClient:uid]; - - // when - [client launchRequest:^(NSDictionary * _Nullable initRes, NSError * _Nullable createUserError) { - XCTAssertNil(createUserError); - - [client sendPushToken:^(BOOL success) { - XCTAssertFalse(success); - [completionExpectation fulfill]; - }]; - }]; - - // then - [self waitForExpectationsWithTimeout:self.kRequestTimeout handler:nil]; -} - - (void)testScreens { // given XCTestExpectation *completionExpectation = [self expectationWithDescription:@"Screens call"]; diff --git a/Podfile.lock b/Podfile.lock index 14bf8490..056f105b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -104,4 +104,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 578415250db59f137d92c9b1ce32646ae18974ba -COCOAPODS: 1.15.2 +COCOAPODS: 1.13.0 diff --git a/Qonversion.podspec b/Qonversion.podspec index 4bf013d2..c348880b 100644 --- a/Qonversion.podspec +++ b/Qonversion.podspec @@ -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.12.2' + s.version = '5.12.3' s.summary = 'qonversion.io' s.description = <<-DESC Deep Analytics for iOS Subscriptions diff --git a/Qonversion.xcodeproj/project.pbxproj b/Qonversion.xcodeproj/project.pbxproj index 48957334..7550281c 100644 --- a/Qonversion.xcodeproj/project.pbxproj +++ b/Qonversion.xcodeproj/project.pbxproj @@ -65,8 +65,6 @@ 701922762B10AB3300724926 /* QONSubscriptionPeriod+Protected.h in Headers */ = {isa = PBXBuildFile; fileRef = 701922752B10AB3300724926 /* QONSubscriptionPeriod+Protected.h */; }; 701BAC102C524626009B16FB /* QONPurchaseOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 701BAC0F2C524626009B16FB /* QONPurchaseOptions.m */; }; 701BAC112C524626009B16FB /* QONPurchaseOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 701BAC0E2C524626009B16FB /* QONPurchaseOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 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 */; }; 702BF8B629531A68000B6C3E /* QONScreenCustomizationDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 702BF8B529531A68000B6C3E /* QONScreenCustomizationDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 702DBDEC2A3216C900D590D0 /* QONExperiment+Protected.h in Headers */ = {isa = PBXBuildFile; fileRef = 702DBDEB2A3216C900D590D0 /* QONExperiment+Protected.h */; }; @@ -393,8 +391,6 @@ 701922752B10AB3300724926 /* QONSubscriptionPeriod+Protected.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "QONSubscriptionPeriod+Protected.h"; sourceTree = ""; }; 701BAC0E2C524626009B16FB /* QONPurchaseOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QONPurchaseOptions.h; sourceTree = ""; }; 701BAC0F2C524626009B16FB /* QONPurchaseOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QONPurchaseOptions.m; sourceTree = ""; }; - 7023948F2923EBF3003126D5 /* QONNotificationsService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QONNotificationsService.h; sourceTree = ""; }; - 702394902923EBF3003126D5 /* QONNotificationsService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QONNotificationsService.m; sourceTree = ""; }; 70283DF629F66FAC00D138BC /* PurchasesMapper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PurchasesMapper.swift; sourceTree = ""; }; 702BF8B529531A68000B6C3E /* QONScreenCustomizationDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QONScreenCustomizationDelegate.h; sourceTree = ""; }; 702DBDEB2A3216C900D590D0 /* QONExperiment+Protected.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "QONExperiment+Protected.h"; sourceTree = ""; }; @@ -906,15 +902,6 @@ path = "NSError+Sugare"; sourceTree = ""; }; - 7023948E2923EBE8003126D5 /* QONNotificationsService */ = { - isa = PBXGroup; - children = ( - 7023948F2923EBF3003126D5 /* QONNotificationsService.h */, - 702394902923EBF3003126D5 /* QONNotificationsService.m */, - ); - path = QONNotificationsService; - sourceTree = ""; - }; 70283DF529F66FAC00D138BC /* Swift */ = { isa = PBXGroup; children = ( @@ -1235,7 +1222,6 @@ 8957320126DD03A3009507A6 /* Services */ = { isa = PBXGroup; children = ( - 7023948E2923EBE8003126D5 /* QONNotificationsService */, 8957320226DD03A3009507A6 /* QONAutomationsService */, 8957320526DD03A3009507A6 /* QONAutomationsScreenProcessor */, ); @@ -1737,7 +1723,6 @@ 895732F326DD03A3009507A6 /* QNUserPropertiesManager.h in Headers */, 70F07B1B28AD085600A45D41 /* QONEntitlementsCacheLifetime.h in Headers */, 707734F42A9F607700CFF742 /* QONRemoteConfigurationSource.h in Headers */, - 702394912923EBF3003126D5 /* QONNotificationsService.h in Headers */, 895732F126DD03A3009507A6 /* QNMapper.h in Headers */, 7097C6BE2A38BFC800565DE4 /* QONRemoteConfig+Protected.h in Headers */, 895732DF26DD03A3009507A6 /* QONUser+Protected.h in Headers */, @@ -2135,7 +2120,6 @@ 895732B326DD03A3009507A6 /* QONAutomationsViewController.m in Sources */, 895732EC26DD03A3009507A6 /* QNUserInfoMapper.m in Sources */, 895732B526DD03A3009507A6 /* QONAutomationsService.m in Sources */, - 702394922923EBF3003126D5 /* QONNotificationsService.m in Sources */, 8957328A26DD03A3009507A6 /* QONActionResult.m in Sources */, 70283DF729F66FAC00D138BC /* PurchasesMapper.swift in Sources */, 701BAC102C524626009B16FB /* QONPurchaseOptions.m in Sources */, @@ -2578,7 +2562,7 @@ CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = MTVL2X9L7N; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 5ZBNSPDUJ2; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MARKETING_VERSION = 1.0; @@ -2599,7 +2583,7 @@ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = MTVL2X9L7N; + DEVELOPMENT_TEAM = 5ZBNSPDUJ2; GENERATE_INFOPLIST_FILE = YES; IPHONEOS_DEPLOYMENT_TARGET = 9.0; MARKETING_VERSION = 1.0; diff --git a/Sample/ActivePermissionsTableViewCell.swift b/Sample/ActivePermissionsTableViewCell.swift index 1b0d7926..dcd01226 100644 --- a/Sample/ActivePermissionsTableViewCell.swift +++ b/Sample/ActivePermissionsTableViewCell.swift @@ -16,7 +16,7 @@ class ActivePermissionsTableViewCell: UITableViewCell { @IBOutlet weak var renewStateLabel: UILabel! func setup(with permission: Qonversion.Entitlement) { - permissionIdLabel.text = "Permission id: \(permission.entitlementID)" + permissionIdLabel.text = "Permission id: \(permission.entitlementID). isActive: \(permission.isActive)" productIdLabel.text = "Product id: \(permission.productID)" var renewState = "" switch permission.renewState { diff --git a/Sample/AuthViewController.swift b/Sample/AuthViewController.swift index f747c487..1f1e8c76 100644 --- a/Sample/AuthViewController.swift +++ b/Sample/AuthViewController.swift @@ -27,6 +27,10 @@ class AuthViewController: UIViewController { } } + @IBAction func didTapSkipAuth(_ sender: Any) { + showMainScreen() + } + @IBAction func didTouchSignInButton(_ sender: Any) { let conf = GIDConfiguration(clientID: "11599271839-qalspkpqrihnkl1e12be731tgmre5uop.apps.googleusercontent.com") GIDSignIn.sharedInstance.signIn(with: conf, presenting: self) { [weak self] user, error in diff --git a/Sample/Base.lproj/Main.storyboard b/Sample/Base.lproj/Main.storyboard index a4572f4f..90640fda 100644 --- a/Sample/Base.lproj/Main.storyboard +++ b/Sample/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -18,7 +18,7 @@ - + @@ -322,10 +334,12 @@ Please use the sign-in with Google option to test cross-platform subscription ma + + @@ -343,7 +357,7 @@ Please use the sign-in with Google option to test cross-platform subscription ma - + @@ -364,11 +378,11 @@ Please use the sign-in with Google option to test cross-platform subscription ma - + - + @@ -477,7 +491,7 @@ Please use the sign-in with Google option to test cross-platform subscription ma - + diff --git a/Sample/ViewController.swift b/Sample/ViewController.swift index 6d7184eb..a03aa0d4 100644 --- a/Sample/ViewController.swift +++ b/Sample/ViewController.swift @@ -13,6 +13,9 @@ import FirebaseAuth class ViewController: UIViewController { + let firstPurchaseButtonProduct = "weekly" + let secondPurchaseButtonProduct = "in_app" + @IBOutlet weak var mainProductSubscriptionButton: UIButton! @IBOutlet weak var inAppPurchaseButton: UIButton! @IBOutlet weak var offeringsButton: UIButton! @@ -80,16 +83,7 @@ class ViewController: UIViewController { self.products = result - if let inAppPurchase = result["consumable"] { - let permission: Qonversion.Entitlement? = self.permissions["standart"] - let isActive = permission?.isActive ?? false - let title: String = isActive ? "Successfully purchased" : "Buy for \(inAppPurchase.prettyPrice)" - self.inAppPurchaseButton.setTitle(title, for: .normal) - self.inAppPurchaseButton.backgroundColor = isActive ? .systemGreen : self.inAppPurchaseButton.backgroundColor - self.checkActivePermissionsButton.isHidden = isActive ? true : false - } - - if let mainSubscription = result["subs_plus_trial"] { + if let mainSubscription = result[firstPurchaseButtonProduct] { let permission: Qonversion.Entitlement? = self.permissions["plus"] let isActive = permission?.isActive ?? false let title: String = isActive ? "Successfully purchased" : "Subscribe for \(mainSubscription.prettyPrice) / \(mainSubscription.prettyDuration)" @@ -97,6 +91,15 @@ class ViewController: UIViewController { self.mainProductSubscriptionButton.backgroundColor = isActive ? .systemGreen : self.mainProductSubscriptionButton.backgroundColor self.checkActivePermissionsButton.isHidden = isActive ? true : false } + + if let inAppPurchase = result[secondPurchaseButtonProduct] { + let permission: Qonversion.Entitlement? = self.permissions["standart"] + let isActive = permission?.isActive ?? false + let title: String = isActive ? "Successfully purchased" : "Buy for \(inAppPurchase.prettyPrice)" + self.inAppPurchaseButton.setTitle(title, for: .normal) + self.inAppPurchaseButton.backgroundColor = isActive ? .systemGreen : self.inAppPurchaseButton.backgroundColor + self.checkActivePermissionsButton.isHidden = isActive ? true : false + } } } @@ -117,7 +120,7 @@ class ViewController: UIViewController { } @IBAction func didTapMainProductSubscriptionButton(_ sender: Any) { - if let product = self.products["subs_plus_trial"] { + if let product = self.products[firstPurchaseButtonProduct] { activityIndicator.startAnimating() Qonversion.shared().purchase(product.qonversionID) { [weak self] (result, error, flag) in guard let self = self else { return } @@ -138,7 +141,7 @@ class ViewController: UIViewController { } @IBAction func didTapInAppPurchaseButton(_ sender: Any) { - if let product = self.products["consumable"] { + if let product = self.products[secondPurchaseButtonProduct] { activityIndicator.startAnimating() Qonversion.shared().purchaseProduct(product) { [weak self] (result, error, flag) in guard let self = self else { return } diff --git a/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.h b/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.h index 5bb44b00..5f08b62e 100644 --- a/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.h +++ b/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.h @@ -10,7 +10,7 @@ #if TARGET_OS_IOS -@class QONAutomationsViewController, QONAutomationsService, QONAutomationsActionsHandler, QONAutomationsScreen, QONAutomationsEventsMapper, QONNotificationsService; +@class QONAutomationsViewController, QONAutomationsService, QONAutomationsActionsHandler, QONAutomationsScreen, QONAutomationsEventsMapper; @protocol QONAutomationsViewControllerDelegate; NS_ASSUME_NONNULL_BEGIN @@ -21,7 +21,6 @@ NS_ASSUME_NONNULL_BEGIN - (QONAutomationsService *)automationsService; - (QONAutomationsActionsHandler *)actionsHandler; - (QONAutomationsEventsMapper *)eventsMapper; -- (QONNotificationsService *)notificationsService; @end diff --git a/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.m b/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.m index 170dfba0..389d7a36 100644 --- a/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.m +++ b/Sources/Qonversion/Automations/Main/QONAutomationsFlowAssembly/QONAutomationsFlowAssembly.m @@ -19,7 +19,6 @@ #import "QONAutomationsScreen.h" #import "QONAutomationsScreenProcessor.h" #import "QONAutomationsEventsMapper.h" -#import "QONNotificationsService.h" @implementation QONAutomationsFlowAssembly @@ -44,13 +43,6 @@ - (QONAutomationsService *)automationsService { return automationsService; } -- (QONNotificationsService *)notificationsService { - QONNotificationsService *notificationsService = [QONNotificationsService new]; - notificationsService.apiClient = [QNAPIClient shared]; - - return notificationsService; -} - - (QONAutomationsMapper *)screensMapper { return [QONAutomationsMapper new]; } diff --git a/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.h b/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.h index e16a95a1..23fc9c4a 100644 --- a/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.h +++ b/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.h @@ -24,7 +24,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)showAutomationWithID:(NSString *)automationID completion:(nullable QONShowScreenCompletionHandler)completion; - (BOOL)handlePushNotification:(NSDictionary *)userInfo; - (void)showAutomationIfExists; -- (void)sendPushToken:(NSData *)pushTokenData; @end diff --git a/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.m b/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.m index 743763fd..76cb1703 100644 --- a/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.m +++ b/Sources/Qonversion/Automations/Main/QONAutomationsFlowCoordinator/QONAutomationsFlowCoordinator.m @@ -24,7 +24,6 @@ #import "QONAutomationsEventsMapper.h" #import "QNInternalConstants.h" #import "QNDevice.h" -#import "QONNotificationsService.h" #import "QONScreenCustomizationDelegate.h" #import "QONAutomationsNavigationController.h" @@ -35,7 +34,6 @@ @interface QONAutomationsFlowCoordinator() )automationsDelegate { @@ -118,33 +113,6 @@ - (void)showAutomationIfExists { }]; } -- (void)sendPushToken:(NSData *)pushTokenData { - NSString *tokenString = [QNUtils convertHexData:pushTokenData]; - NSString *oldToken = [QNDevice current].pushNotificationsToken; - if ([tokenString isEqualToString:oldToken] || tokenString.length == 0) { - return; - } - - [[QNDevice current] setPushNotificationsToken:tokenString]; - [[QNDevice current] setPushTokenProcessed:NO]; - - if (!self.isSDKLaunched) { - return; - } - - [self processPushTokenRequest]; -} - -- (void)processPushTokenRequest { - NSString *pushToken = [[QNDevice current] pushNotificationsToken]; - BOOL isPushTokenProcessed = [[QNDevice current] isPushTokenProcessed]; - if (!pushToken || isPushTokenProcessed) { - return; - } - - [self.notificationsService sendPushToken]; -} - - (void)showAutomationWithID:(NSString *)automationID completion:(nullable QONShowScreenCompletionHandler)completion { __block __weak QONAutomationsFlowCoordinator *weakSelf = self; [self.automationsService automationWithID:automationID completion:^(QONAutomationsScreen *screen, NSError * _Nullable error) { diff --git a/Sources/Qonversion/Automations/Services/QONNotificationsService/QONNotificationsService.h b/Sources/Qonversion/Automations/Services/QONNotificationsService/QONNotificationsService.h deleted file mode 100644 index 398dac33..00000000 --- a/Sources/Qonversion/Automations/Services/QONNotificationsService/QONNotificationsService.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// QONNotificationsService.h -// Qonversion -// -// Created by Suren Sarkisyan on 15.11.2022. -// Copyright © 2022 Qonversion Inc. All rights reserved. -// - -#import -#import "QNAPIClient.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface QONNotificationsService : NSObject - -@property (nonatomic, strong) QNAPIClient *apiClient; - -- (void)sendPushToken; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sources/Qonversion/Automations/Services/QONNotificationsService/QONNotificationsService.m b/Sources/Qonversion/Automations/Services/QONNotificationsService/QONNotificationsService.m deleted file mode 100644 index f2006e10..00000000 --- a/Sources/Qonversion/Automations/Services/QONNotificationsService/QONNotificationsService.m +++ /dev/null @@ -1,22 +0,0 @@ -// -// QONNotificationsService.m -// Qonversion -// -// Created by Suren Sarkisyan on 15.11.2022. -// Copyright © 2022 Qonversion Inc. All rights reserved. -// - -#import "QONNotificationsService.h" -#import "QNDevice.h" - -@implementation QONNotificationsService - -- (void)sendPushToken { - [self.apiClient sendPushToken:^(BOOL success) { - if (success) { - [[QNDevice current] setPushTokenProcessed:YES]; - } - }]; -} - -@end diff --git a/Sources/Qonversion/Public/QONAutomations.h b/Sources/Qonversion/Public/QONAutomations.h index 2e190675..04646746 100644 --- a/Sources/Qonversion/Public/QONAutomations.h +++ b/Sources/Qonversion/Public/QONAutomations.h @@ -57,14 +57,14 @@ NS_SWIFT_NAME(setScreenCustomizationDelegate(_:)); Set push token to Qonversion to enable Qonversion push notifications @param token - token data */ -- (void)setNotificationsToken:(nonnull NSData *)token API_AVAILABLE(ios(9.0)); +- (void)setNotificationsToken:(nonnull NSData *)token API_AVAILABLE(ios(9.0)) DEPRECATED_MSG_ATTRIBUTE("Consider removing this method calls as they aren't needed anymore"); /** Returns true when a push notification was received from Qonversion. Otherwise returns false, so you need to handle a notification yourself @param userInfo - notification user info */ -- (BOOL)handleNotification:(nonnull NSDictionary *)userInfo API_AVAILABLE(ios(9.0)); +- (BOOL)handleNotification:(nonnull NSDictionary *)userInfo API_AVAILABLE(ios(9.0)) DEPRECATED_MSG_ATTRIBUTE("Consider removing this method calls. Qonversion is not working with push notifications anymore"); /** Get parsed custom payload, which you added to the notification in the dashboard diff --git a/Sources/Qonversion/Public/QONAutomations.m b/Sources/Qonversion/Public/QONAutomations.m index bdb05413..275d8366 100644 --- a/Sources/Qonversion/Public/QONAutomations.m +++ b/Sources/Qonversion/Public/QONAutomations.m @@ -48,9 +48,7 @@ - (void)showScreenWithID:(nonnull NSString *)screenID completion:(nullable QONSh [[QONAutomationsFlowCoordinator sharedInstance] showAutomationWithID:screenID completion:completion]; } -- (void)setNotificationsToken:(nonnull NSData *)token { - [[QONAutomationsFlowCoordinator sharedInstance] sendPushToken:token]; -} +- (void)setNotificationsToken:(nonnull NSData *)token {} - (BOOL)handleNotification:(nonnull NSDictionary *)userInfo { return [[QONAutomationsFlowCoordinator sharedInstance] handlePushNotification:userInfo]; diff --git a/Sources/Qonversion/Public/QONConfiguration.m b/Sources/Qonversion/Public/QONConfiguration.m index db105fbf..b3179a0f 100644 --- a/Sources/Qonversion/Public/QONConfiguration.m +++ b/Sources/Qonversion/Public/QONConfiguration.m @@ -9,7 +9,7 @@ #import "QONConfiguration.h" #import "QNAPIConstants.h" -static NSString *const kSDKVersion = @"5.12.2"; +static NSString *const kSDKVersion = @"5.12.3"; @interface QONConfiguration () diff --git a/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.h b/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.h index 2eba64db..80a8d3ea 100644 --- a/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.h +++ b/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.h @@ -10,7 +10,6 @@ extern NSString *const kAPIBase; extern NSString *const kInitEndpoint; -extern NSString *const kSendPushTokenEndpoint; extern NSString *const kPurchaseEndpoint; extern NSString *const kGetPromoOfferDetailsEndpoint; extern NSString *const kProductsEndpoint; diff --git a/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.m b/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.m index 78b0ddbc..e9dcf2ec 100644 --- a/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.m +++ b/Sources/Qonversion/Qonversion/Constants/QNAPIConstants/QNAPIConstants.m @@ -12,7 +12,6 @@ NSString * const kSdkLogsBaseURL = @"https://sdk-logs.qonversion.io/"; NSString * const kInitEndpoint = @"v1/user/init"; -NSString * const kSendPushTokenEndpoint = @"v1/user/push-token"; NSString * const kPurchaseEndpoint = @"v1/user/purchase"; // TODO: Update endpoint NSString * const kGetPromoOfferDetailsEndpoint = @"update_promo_offer_endpoint_here"; diff --git a/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.h b/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.h index fd477cb4..6a3a8823 100644 --- a/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.h +++ b/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.h @@ -12,7 +12,6 @@ typedef NS_ENUM(NSInteger, QONRequestType) { - (void)setBaseURL:(NSString *)url; - (void)setSDKVersion:(NSString *)version; - (NSURLRequest *)makeInitRequestWith:(NSDictionary *)parameters; -- (NSURLRequest *)makeSendPushTokenRequestWith:(NSDictionary *)parameters; - (NSURLRequest *)makeUserInfoRequestWithID:(NSString *)userID apiKey:(NSString *)apiKey; - (NSURLRequest *)makeSendPropertiesRequestForUserId:(NSString *)userId parameters:(NSArray *)parameters; - (NSURLRequest *)makeGetPropertiesRequestForUserId:(NSString *)userId; diff --git a/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.m b/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.m index 2311607d..736469c3 100644 --- a/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.m +++ b/Sources/Qonversion/Qonversion/Core/QNRequestBuilder/QNRequestBuilder.m @@ -25,10 +25,6 @@ - (void)setBaseURL:(NSString *)url { _baseURL = url; } -- (NSURLRequest *)makeSendPushTokenRequestWith:(NSDictionary *)parameters { - return [self makeRequestWithDictBody:parameters baseURL:self.baseURL endpoint:kSendPushTokenEndpoint type:QONRequestTypePost]; -} - - (NSURLRequest *)makeInitRequestWith:(NSDictionary *)parameters { return [self makeRequestWithDictBody:parameters baseURL:self.baseURL endpoint:kInitEndpoint type:QONRequestTypePost]; } diff --git a/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.h b/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.h index 32b8c229..58d032ec 100644 --- a/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.h +++ b/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.h @@ -13,7 +13,6 @@ NS_ASSUME_NONNULL_BEGIN purchaseOptions:(nullable QONPurchaseOptions *)purchaseOptions; - (NSDictionary *)introTrialEligibilityDataForProducts:(NSArray *)products; -- (NSDictionary *)pushTokenData; - (NSDictionary *)attributionDataWithDict:(NSDictionary *)data fromProvider:(QONAttributionProvider)provider; - (NSDictionary *)purchaseInfo:(QONStoreKit2PurchaseModel *)purchaseInfo diff --git a/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.m b/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.m index 442fb231..568a5bc3 100644 --- a/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.m +++ b/Sources/Qonversion/Qonversion/Core/QNRequestSerializer/QNRequestSerializer.m @@ -26,14 +26,6 @@ - (NSDictionary *)mainData { return QNUserInfo.overallData; } -- (NSDictionary *)pushTokenData { - NSMutableDictionary *data = [NSMutableDictionary new]; - data[@"push_token"] = [[QNDevice current] pushNotificationsToken]; - data[@"device_id"] = [[QNDevice current] vendorID]; - - return [data copy]; -} - - (NSDictionary *)purchaseData:(SKProduct *)product transaction:(SKPaymentTransaction *)transaction receipt:(nullable NSString *)receipt diff --git a/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.h b/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.h index 729df968..410998e4 100644 --- a/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.h +++ b/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.h @@ -25,7 +25,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)setSDKVersion:(NSString *)version; - (void)setBaseURL:(NSString *)url; - (void)launchRequest:(QNAPIClientDictCompletionHandler)completion; -- (void)sendPushToken:(void (^)(BOOL success))completion; - (NSURLRequest *)purchaseRequestWith:(SKProduct *)product transaction:(SKPaymentTransaction *)transaction diff --git a/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.m b/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.m index e35fa6fc..470036d4 100644 --- a/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.m +++ b/Sources/Qonversion/Qonversion/Services/QNAPIClient/QNAPIClient.m @@ -119,17 +119,6 @@ - (void)processRequest:(NSURLRequest *)request parseResponse:(BOOL)parseResponse // MARK: - Public -- (void)sendPushToken:(void (^)(BOOL success))completion { - NSDictionary *data = [self.requestSerializer pushTokenData]; - data = [self enrichPushTokenData:data]; - NSURLRequest *request = [self.requestBuilder makeSendPushTokenRequestWith:data]; - - [self processDictRequest:request completion:^(NSDictionary * _Nullable dict, NSError * _Nullable error) { - BOOL isSuccess = error == nil; - completion(isSuccess); - }]; -} - - (void)launchRequest:(QNAPIClientDictCompletionHandler)completion { NSDictionary *launchData = [self.requestSerializer launchData]; @@ -493,14 +482,6 @@ - (void)detachUserFromRemoteConfiguration:(NSString *)remoteConfigurationId comp // MARK: - Private -- (NSDictionary *)enrichPushTokenData:(NSDictionary *)data { - NSMutableDictionary *mutableData = [data mutableCopy]; - mutableData[@"access_token"] = _apiKey; - mutableData[@"q_uid"] = _userID; - - return [mutableData copy]; -} - - (NSString *)obtainApiKey { return self.debug ? [NSString stringWithFormat:@"test_%@", self.apiKey] : self.apiKey; } diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h index c883fe77..f18a543c 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h @@ -23,11 +23,5 @@ @property (readonly, copy, nonatomic) NSString *fbAnonID; @property (readonly, copy, nonatomic) NSString *installDate; -@property (readonly, copy, nonatomic) NSString *pushNotificationsToken; - -- (BOOL)isPushTokenProcessed; -- (void)setPushTokenProcessed:(BOOL)processed; - -- (void)setPushNotificationsToken:(NSString *)token; @end diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m index 3c098a13..5a84fad0 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m @@ -15,12 +15,9 @@ #import static NSString * const kUserDefaultsSuiteName = @"qonversion.device.suite"; -static NSString * const kPushTokenKey = @"pushToken"; -static NSString * const kPushTokenProcessedKey = @"pushTokenProcessed"; @interface QNDevice () -@property (readwrite, copy, nonatomic) NSString *pushNotificationsToken; @property (strong, nonatomic) id persistentStorage; @property (assign, nonatomic) BOOL idfaProhibited; @@ -47,9 +44,7 @@ - (instancetype)init { QNUserDefaultsStorage *storage = [QNUserDefaultsStorage new]; storage.userDefaults = [[NSUserDefaults alloc] initWithSuiteName:kUserDefaultsSuiteName]; _persistentStorage = storage; - - NSString *token = [_persistentStorage loadObjectForKey:kPushTokenKey]; - _pushNotificationsToken = [token isKindOfClass:[NSString class]] ? token : nil; + _idfaProhibited = NO; } @@ -163,19 +158,6 @@ - (NSString *)language { return _language; } -- (void)setPushNotificationsToken:(NSString *)token { - _pushNotificationsToken = token; - [self.persistentStorage storeObject:token forKey:kPushTokenKey]; -} - -- (BOOL)isPushTokenProcessed { - return [self.persistentStorage loadBoolforKey:kPushTokenProcessedKey]; -} - -- (void)setPushTokenProcessed:(BOOL)processed { - [self.persistentStorage storeBool:processed forKey:kPushTokenProcessedKey]; -} - - (NSString *)advertiserID { if (!_advertiserID && !self.idfaProhibited) { SEL selector = NSSelectorFromString(@"obtainAdvertisingID"); diff --git a/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.h b/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.h index 2e4ac639..b2d872b6 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.h +++ b/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.h @@ -56,7 +56,6 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ @interface QNUtils : NSObject + (BOOL)isEmptyString:(NSString *)string; -+ (NSString *)convertHexData:(NSData *)tokenData; + (NSDate *)dateFromTimestamp:(NSNumber *)timestamp; + (BOOL)isPermissionsOutdatedForDefaultState:(BOOL)defaultState cacheDataTimeInterval:(NSTimeInterval)cacheDataTimeInterval cacheLifetime:(QONEntitlementsCacheLifetime)cacheLifetime; + (NSDate *)calculateExpirationDateForPeriod:(SKProductSubscriptionPeriod *)period fromDate:(NSDate *)transactionDate API_AVAILABLE(ios(11.2), watchos(6.2), macosx(10.13.2), tvos(11.2)); diff --git a/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.m b/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.m index e03cf447..e2f90a7e 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.m +++ b/Sources/Qonversion/Qonversion/Utils/QNUtils/QNUtils.m @@ -10,15 +10,6 @@ + (BOOL)isEmptyString:(NSString *)string { return string == nil || [string isKindOfClass:[NSNull class]] || [string length] == 0; } -+ (NSString *)convertHexData:(NSData *)tokenData { - const unsigned char *bytes = (const unsigned char *)tokenData.bytes; - NSMutableString *hex = [NSMutableString new]; - for (NSInteger i = 0; i < tokenData.length; i++) { - [hex appendFormat:@"%02x", bytes[i]]; - } - return [hex copy]; -} - + (BOOL)isCacheOutdated:(NSTimeInterval)cacheDataTimeInterval cacheLifetime:(CGFloat)cacheLifetimeInSeconds { NSDate *currentDate = [NSDate date]; return (currentDate.timeIntervalSince1970 - cacheDataTimeInterval) > cacheLifetimeInSeconds; diff --git a/fastlane/report.xml b/fastlane/report.xml index 8a14e059..e6b2d965 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,12 @@ - + - +