From aff055607f902ca86e54f7a3033a4697283941f5 Mon Sep 17 00:00:00 2001 From: Surik Date: Thu, 10 Oct 2024 14:52:14 +0400 Subject: [PATCH 1/7] Fixed syncHistoricalData function logic --- Sources/Qonversion/Public/Qonversion.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Qonversion/Public/Qonversion.m b/Sources/Qonversion/Public/Qonversion.m index 173dd53a..506afe75 100644 --- a/Sources/Qonversion/Public/Qonversion.m +++ b/Sources/Qonversion/Public/Qonversion.m @@ -105,7 +105,7 @@ - (void)syncHistoricalData { return; } - [[Qonversion sharedInstance] restore:^(NSDictionary * _Nonnull result, NSError * _Nullable error) { + [[Qonversion sharedInstance].productCenterManager restoreTransactions:^(NSDictionary * _Nonnull result, NSError * _Nullable error) { if (error) { QONVERSION_LOG(@"❌ Historical data sync failed: %@", error.localizedDescription); } else { From 8197c8ed7f5962f3ea3d4193092cee48d2461b01 Mon Sep 17 00:00:00 2001 From: Surik Date: Fri, 11 Oct 2024 14:18:48 +0400 Subject: [PATCH 2/7] Updated adjust user id fetching logic --- .../QNUserPropertiesManager.m | 9 ++++--- .../Qonversion/Utils/QNDevice/QNDevice.h | 3 ++- .../Qonversion/Utils/QNDevice/QNDevice.m | 25 +++++++++++-------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Sources/Qonversion/Qonversion/Main/QNUserPropertiesManager/QNUserPropertiesManager.m b/Sources/Qonversion/Qonversion/Main/QNUserPropertiesManager/QNUserPropertiesManager.m index 6a95b294..33cb74e8 100644 --- a/Sources/Qonversion/Qonversion/Main/QNUserPropertiesManager/QNUserPropertiesManager.m +++ b/Sources/Qonversion/Qonversion/Main/QNUserPropertiesManager/QNUserPropertiesManager.m @@ -223,10 +223,11 @@ - (void)collectIntegrationsData { } - (void)collectIntegrationsDataInBackground { - NSString *adjustUserID = _device.adjustUserID; - if (![QNUtils isEmptyString:adjustUserID]) { - [self setUserProperty:@"_q_adjust_adid" value:adjustUserID]; - } + [_device adjustUserIDWithCompletion:^(NSString * _Nullable userId) { + if (![QNUtils isEmptyString:userId]) { + [self setUserProperty:@"_q_adjust_adid" value:userId]; + } + }]; NSString *fbAnonID = _device.fbAnonID; if (![QNUtils isEmptyString:fbAnonID]) { diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h index f18a543c..93891c84 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h @@ -19,9 +19,10 @@ @property (readonly, copy, nonatomic) NSString *vendorID; @property (readonly, copy, nonatomic) NSString *afUserID; -@property (readonly, copy, nonatomic) NSString *adjustUserID; @property (readonly, copy, nonatomic) NSString *fbAnonID; @property (readonly, copy, nonatomic) NSString *installDate; +- (void)adjustUserIDWithCompletion:(void(^)(NSString * _Nullable userId))completion; + @end diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m index 5a84fad0..75716f63 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m @@ -258,20 +258,23 @@ - (nullable NSString *)fbAnonID { return nil; } -- (nullable NSString *)adjustUserID { +- (void)adjustUserIDWithCompletion:(void(^)(NSString * _Nullable userId))completion { Class Adjust = NSClassFromString(@"Adjust"); - SEL adid = NSSelectorFromString(@"adid"); - if (Adjust && adid) { - id (*imp1)(id, SEL) = (id (*)(id, SEL))[Adjust methodForSelector:adid]; - NSString *adidString = nil; - if (imp1) { - adidString = imp1(Adjust, adid); + if (Adjust) { + SEL adid = NSSelectorFromString(@"adid"); + SEL adidWithCompletion = NSSelectorFromString(@"adidWithCompletionHandler:"); + if ([Adjust respondsToSelector:adid]) { + id (*imp1)(id, SEL) = (id (*)(id, SEL))[Adjust methodForSelector:adid]; + NSString *adidString = nil; + if (imp1) { + adidString = imp1(Adjust, adid); + } + + completion(adidString); + } else if ([Adjust respondsToSelector:adidWithCompletion]) { + [Adjust performSelector:adidWithCompletion withObject:completion]; } - - return adidString; } - - return nil; } - (NSString *)vendorID { From 35a3be095325137e6c541d0dc8e10f54953eb557 Mon Sep 17 00:00:00 2001 From: Surik Date: Fri, 11 Oct 2024 16:46:03 +0400 Subject: [PATCH 3/7] Fixed warnings --- Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h | 2 +- Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h index 93891c84..917e4d3b 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.h @@ -23,6 +23,6 @@ @property (readonly, copy, nonatomic) NSString *installDate; -- (void)adjustUserIDWithCompletion:(void(^)(NSString * _Nullable userId))completion; +- (void)adjustUserIDWithCompletion:(void(^)(NSString *userId))completion; @end diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m index 75716f63..8dfc8e49 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m @@ -258,7 +258,7 @@ - (nullable NSString *)fbAnonID { return nil; } -- (void)adjustUserIDWithCompletion:(void(^)(NSString * _Nullable userId))completion { +- (void)adjustUserIDWithCompletion:(void(^)(NSString *userId))completion { Class Adjust = NSClassFromString(@"Adjust"); if (Adjust) { SEL adid = NSSelectorFromString(@"adid"); From 3b68bfb222b1aa44e21356d2bf92471a4fd2b00a Mon Sep 17 00:00:00 2001 From: Surik Date: Fri, 11 Oct 2024 16:57:22 +0400 Subject: [PATCH 4/7] Added error for empty offerings and empty error case --- Sources/Qonversion/Public/QONErrors.h | 6 +++++- Sources/Qonversion/Public/QONErrors.m | 7 +++++++ .../Main/QNProductCenterManager/QNProductCenterManager.m | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Sources/Qonversion/Public/QONErrors.h b/Sources/Qonversion/Public/QONErrors.h index 5d2ce103..820e79c6 100644 --- a/Sources/Qonversion/Public/QONErrors.h +++ b/Sources/Qonversion/Public/QONErrors.h @@ -67,7 +67,10 @@ typedef NS_ERROR_ENUM(QONErrorDomain, QONError) { QONErrorStorePaymentDeferred = 18, // No remote configuration for the current user - QONErrorRemoteConfigurationNotAvailable = 19 + QONErrorRemoteConfigurationNotAvailable = 19, + + // No offerings for the current user + QONErrorOfferingsNotAvailable = 20, } NS_SWIFT_NAME(Qonversion.Error); @@ -131,6 +134,7 @@ typedef NS_ERROR_ENUM(QONErrorDomain, QONAPIError) { + (NSError *)errorFromURLDomainError:(NSError *)error; + (NSError *)errorFromTransactionError:(NSError *)error; + (NSError *)deferredTransactionError; ++ (NSError *)emptyOfferingsError; @end diff --git a/Sources/Qonversion/Public/QONErrors.m b/Sources/Qonversion/Public/QONErrors.m index 8349682b..4588f8cf 100644 --- a/Sources/Qonversion/Public/QONErrors.m +++ b/Sources/Qonversion/Public/QONErrors.m @@ -58,6 +58,13 @@ + (NSError *)deferredTransactionError { return [self errorWithQonversionErrorCode:QONErrorStorePaymentDeferred userInfo:[userInfo copy]]; } ++ (NSError *)emptyOfferingsError { + NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; + userInfo[NSLocalizedDescriptionKey] = @"Offerings are not available"; + + return [self errorWithQonversionErrorCode:QONErrorOfferingsNotAvailable userInfo:[userInfo copy]]; +} + + (NSError *)errorFromTransactionError:(NSError *)error { QONError errorCode = QONErrorUnknown; NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init]; diff --git a/Sources/Qonversion/Qonversion/Main/QNProductCenterManager/QNProductCenterManager.m b/Sources/Qonversion/Qonversion/Main/QNProductCenterManager/QNProductCenterManager.m index cfba7f8a..0a443f63 100644 --- a/Sources/Qonversion/Qonversion/Main/QNProductCenterManager/QNProductCenterManager.m +++ b/Sources/Qonversion/Qonversion/Main/QNProductCenterManager/QNProductCenterManager.m @@ -616,6 +616,10 @@ - (void)executeOfferingsBlocksWithError:(NSError * _Nullable)error { QONOfferings *offerings = [self enrichOfferingsWithStoreProducts]; resultError = offerings ? nil : resultError; + if (!offerings && !resultError) { + resultError = [QONErrors emptyOfferingsError]; + } + for (QONOfferingsCompletionHandler block in blocks) { run_block_on_main(block, offerings, resultError); } From 113dbbbcea81d1381a9b79fde55e6b3f4a458ef9 Mon Sep 17 00:00:00 2001 From: Surik Date: Fri, 11 Oct 2024 18:26:22 +0400 Subject: [PATCH 5/7] Fixed checks --- QonversionTests/QDeviceTests.m | 5 ----- Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m | 5 ++++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/QonversionTests/QDeviceTests.m b/QonversionTests/QDeviceTests.m index 72ff6ea5..be166cff 100644 --- a/QonversionTests/QDeviceTests.m +++ b/QonversionTests/QDeviceTests.m @@ -52,9 +52,4 @@ - (void)testVendorID { XCTAssertEqualObjects(_device.vendorID, [[[UIDevice currentDevice] identifierForVendor] UUIDString]); } -- (void)testAfUserID { - XCTAssertNil(_device.afUserID); - XCTAssertNil(_device.adjustUserID); -} - @end diff --git a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m index 8dfc8e49..0c216a8e 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m +++ b/Sources/Qonversion/Qonversion/Utils/QNDevice/QNDevice.m @@ -272,7 +272,10 @@ - (void)adjustUserIDWithCompletion:(void(^)(NSString *userId))completion { completion(adidString); } else if ([Adjust respondsToSelector:adidWithCompletion]) { - [Adjust performSelector:adidWithCompletion withObject:completion]; + id (*imp1)(id, SEL, id) = (id (*)(id, SEL, id))[Adjust methodForSelector:adidWithCompletion]; + if (imp1) { + imp1(Adjust, adidWithCompletion, completion); + } } } } From 8542e74d29ccf4560560b8d426e1902a26389499 Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Tue, 15 Oct 2024 11:26:12 +0300 Subject: [PATCH 6/7] Tenjin integration --- Sources/Qonversion/Public/QONUserProperty.h | 1 + .../Qonversion/Qonversion/Utils/QNProperties/QNProperties.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Sources/Qonversion/Public/QONUserProperty.h b/Sources/Qonversion/Public/QONUserProperty.h index 32db1660..467e68f4 100644 --- a/Sources/Qonversion/Public/QONUserProperty.h +++ b/Sources/Qonversion/Public/QONUserProperty.h @@ -27,6 +27,7 @@ typedef NS_ENUM(NSInteger, QONUserPropertyKey) { QONUserPropertyKeyPushWooshHwId, QONUserPropertyKeyAppMetricaDeviceId, QONUserPropertyKeyAppMetricaUserProfileId, + QONUserPropertyKeyTenjinAnalyticsInstallationId, QONUserPropertyKeyCustom, } NS_SWIFT_NAME(Qonversion.UserPropertyKey); diff --git a/Sources/Qonversion/Qonversion/Utils/QNProperties/QNProperties.m b/Sources/Qonversion/Qonversion/Utils/QNProperties/QNProperties.m index 9755f2f3..2b29b1d6 100644 --- a/Sources/Qonversion/Qonversion/Utils/QNProperties/QNProperties.m +++ b/Sources/Qonversion/Qonversion/Utils/QNProperties/QNProperties.m @@ -49,6 +49,9 @@ + (nullable NSString *)keyForProperty:(QONUserPropertyKey) property { case QONUserPropertyKeyAppMetricaUserProfileId: key = @"_q_appmetrica_user_profile_id"; break; + case QONUserPropertyKeyTenjinAnalyticsInstallationId: + key = @"_q_tenjin_aiid"; + break; case QONUserPropertyKeyCustom: key = nil; break; @@ -73,6 +76,7 @@ + (QONUserPropertyKey)propertyKeyFromString:(NSString *)key { @"_q_pushwoosh_hwid": @(QONUserPropertyKeyPushWooshHwId), @"_q_appmetrica_device_id": @(QONUserPropertyKeyAppMetricaDeviceId), @"_q_appmetrica_user_profile_id": @(QONUserPropertyKeyAppMetricaUserProfileId), + @"_q_tenjin_aiid": @(QONUserPropertyKeyTenjinAnalyticsInstallationId), }; return propertiesMap[key] ? propertiesMap[key].integerValue : QONUserPropertyKeyCustom; From 80142500ff00e8aff4a2b9f58aed4e0eea12968a Mon Sep 17 00:00:00 2001 From: SpertsyanKM Date: Tue, 15 Oct 2024 11:01:36 +0000 Subject: [PATCH 7/7] [create-pull-request] automated change --- Framework/Info.plist | 2 +- Qonversion.podspec | 2 +- Sources/Qonversion/Public/QONConfiguration.m | 2 +- fastlane/report.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Framework/Info.plist b/Framework/Info.plist index fb471fb5..ab28e747 100644 --- a/Framework/Info.plist +++ b/Framework/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 5.12.3 + 5.12.4 CFBundleSignature ???? CFBundleVersion diff --git a/Qonversion.podspec b/Qonversion.podspec index c348880b..055e0324 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.3' + s.version = '5.12.4' s.summary = 'qonversion.io' s.description = <<-DESC Deep Analytics for iOS Subscriptions diff --git a/Sources/Qonversion/Public/QONConfiguration.m b/Sources/Qonversion/Public/QONConfiguration.m index b3179a0f..22735e63 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.3"; +static NSString *const kSDKVersion = @"5.12.4"; @interface QONConfiguration () diff --git a/fastlane/report.xml b/fastlane/report.xml index e6b2d965..b36a778c 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,12 @@ - + - +