From 5278a146ce6cf365cd5ed660a8462f8893346eb9 Mon Sep 17 00:00:00 2001 From: Taras Dehtiar Date: Thu, 29 Jun 2023 11:32:45 +0200 Subject: [PATCH] [PR-16122] Remove TKBLDidReceiveReward notification (#22) --- Package.swift | 4 +-- README.md | 4 +-- Talkable/TKBLConstants.h | 3 +- Talkable/TKBLConstants.m | 4 +-- Talkable/Talkable.m | 47 +++------------------------ TalkableSDK.podspec | 2 +- TalkableSDK.xcodeproj/project.pbxproj | 12 +++---- 7 files changed, 19 insertions(+), 57 deletions(-) diff --git a/Package.swift b/Package.swift index 8001ece..9742eda 100644 --- a/Package.swift +++ b/Package.swift @@ -2,9 +2,9 @@ import PackageDescription -let version = "1.4.15" +let version = "1.5.1" // Checksum of the file at `sdkUrl` link. To generate: `swift package compute-checksum build/talkable_ios_sdk.zip` -let checksum = "d893d6ea4b651deb119db6f463ed1bf4ffc4dc7d7cf6b1c0566c14d25f6e4ca6" +let checksum = "18cc1cf4dd028279b91065ddf19e1c7beae3f99ea657ba1c5a3380743c94b52b" let sdkUrl = "https://github.com/talkable/ios-sdk/releases/download/\(version)/talkable_ios_sdk_\(version).zip" let package = Package( diff --git a/README.md b/README.md index 7f0f797..eee767e 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add Talkable SDK as a dependency to [`Package.swift`](https://www.swift.org/pack ```swift dependencies: [ - .package(url: "https://github.com/talkable/ios-sdk.git", .upToNextMajor(from: "1.4.15")) + .package(url: "https://github.com/talkable/ios-sdk.git", .upToNextMajor(from: "1.5.1")) ] ``` @@ -28,7 +28,7 @@ dependencies: [ To integrate Talkable SDK into your Xcode project using CocoaPods, specify it in your [`Podfile`](https://guides.cocoapods.org/using/the-podfile.html): ```ruby -pod 'TalkableSDK', '~> 1.4.15' +pod 'TalkableSDK', '~> 1.5.1' ``` ## Manual building diff --git a/Talkable/TKBLConstants.h b/Talkable/TKBLConstants.h index d1af98a..529cb99 100644 --- a/Talkable/TKBLConstants.h +++ b/Talkable/TKBLConstants.h @@ -23,7 +23,7 @@ FOUNDATION_EXPORT NSString* TKBLMessageOfferClose; FOUNDATION_EXPORT NSString* TKBLMessageCouponIssued; FOUNDATION_EXPORT NSString* TKBLDidReceiveCouponCode; -FOUNDATION_EXPORT NSString* TKBLDidReceiveReward; +FOUNDATION_EXPORT NSString* TKBLDidReceiveReward __deprecated; FOUNDATION_EXPORT NSString* TKBLOriginKey; FOUNDATION_EXPORT NSString* TKBLOriginTypeKey; @@ -96,4 +96,3 @@ FOUNDATION_EXPORT NSString* TKBLShareRecipients; FOUNDATION_EXPORT NSString* TKBLShareImage; FOUNDATION_EXPORT NSString* TKBLProductKey; - diff --git a/Talkable/TKBLConstants.m b/Talkable/TKBLConstants.m index ce6d80c..5157ad7 100644 --- a/Talkable/TKBLConstants.m +++ b/Talkable/TKBLConstants.m @@ -8,7 +8,7 @@ #import "TKBLConstants.h" -NSString* TKBLVersion = @"1.4.15"; +NSString* TKBLVersion = @"1.5.1"; NSString* TKBLErrorDomain = @"com.talkable.ios-sdk"; @@ -23,7 +23,7 @@ NSString* TKBLMessageCouponIssued = @"coupon_issued"; NSString* TKBLDidReceiveCouponCode = @"TKBLDidReceiveCouponCodeNotificationName"; -NSString* TKBLDidReceiveReward = @"TKBLDidReceiveRewordNotificationName"; +NSString* TKBLDidReceiveReward = @"TKBLDidReceiveRewordNotificationName"; // deprecated NSString* TKBLOriginKey = @"o"; NSString* TKBLOriginTypeKey = @"type"; diff --git a/Talkable/Talkable.m b/Talkable/Talkable.m index 48cb900..7610852 100644 --- a/Talkable/Talkable.m +++ b/Talkable/Talkable.m @@ -99,16 +99,6 @@ + (id)allocWithZone:(NSZone*)zone { return nil; } -- (id)init { - if (self = [super init]) { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(applicationDidBecomeActive:) - name:UIApplicationDidBecomeActiveNotification - object:nil]; - } - return self; -} - # pragma mark - [Setters and Getters] - (void)setServer:(NSString*)server { @@ -385,7 +375,7 @@ - (void)createOrigin:(NSDictionary*)params withHandler:(TKBLCompletionHandler)ha NSString* urlString = [self urlForAPI:@"/origins"]; [self logAPIRequest:urlString withMethod:@"POST" andParameters:parameters]; - + [[self networkClient] POST:urlString parameters:parameters headers:nil constructingBodyWithBlock:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { [self processSuccessfulResponse:responseObject withHandler:handler]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { @@ -409,7 +399,7 @@ - (void)retrieveRewards:(NSDictionary*)params withHandler:(TKBLCompletionHandler NSString* urlString = [self urlForAPI:@"/rewards"]; [self logAPIRequest:urlString withMethod:@"GET" andParameters:parameters]; - + [[self networkClient] GET:urlString parameters:parameters headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { [self processSuccessfulResponse:responseObject withHandler:handler]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { @@ -429,7 +419,7 @@ - (void)retrieveOffer:(NSString*)shortUrlCode withParams:(NSDictionary*)params a NSString* urlString = [self urlForAPI:path]; [self logAPIRequest:urlString withMethod:@"GET" andParameters:parameters]; - + [[self networkClient] GET:urlString parameters:parameters headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { [self processSuccessfulResponse:responseObject withHandler:handler]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { @@ -458,7 +448,7 @@ - (void)createSocialShare:(NSString*)shortUrlCode channel:(NSString*)channel wit NSString* urlString = [self urlForAPI:path]; [self logAPIRequest:urlString withMethod:@"POST" andParameters:parameters]; - + [[self networkClient] POST:urlString parameters:parameters headers:nil constructingBodyWithBlock:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { [self processSuccessfulResponse:responseObject withHandler:handler]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { @@ -479,7 +469,7 @@ - (void)createEmailShare:(NSString*)shortUrlCode recipients:(NSString*)recipient NSString* urlString = [self urlForAPI:path]; [self logAPIRequest:urlString withMethod:@"POST" andParameters:parameters]; - + [[self networkClient] POST:urlString parameters:parameters headers:nil constructingBodyWithBlock:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { [self processSuccessfulResponse:responseObject withHandler:handler]; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { @@ -588,7 +578,6 @@ - (void)registerInstallIfNeeded { [self retryRegisterInstall]; } else { [TKBLHelper registerInstall]; - [self scheduleRetrieveRewards:0.0]; } }]; } @@ -602,28 +591,6 @@ - (void)scheduleRegisterInstall:(NSTimeInterval)delay { [self performSelector:@selector(registerInstallIfNeeded) withObject:nil afterDelay:delay]; } -#pragma mark - [Retrieve Rewards] - -- (void)retrieveRewardsIfNeeded { - [self retrieveRewardsWithHandler:^(NSDictionary* response, NSError* error) { - if (error) { - TKBLLog(@"%@", error.localizedDescription); - } else { - NSArray *rewards = (NSArray *)[response objectForKey:@"rewards"]; - if ([rewards count] > 0) { - [rewards enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { - [[NSNotificationCenter defaultCenter] postNotificationName:TKBLDidReceiveReward object:self userInfo:(NSDictionary*)obj]; - }]; - } - } - }]; -} - -- (void)scheduleRetrieveRewards:(NSTimeInterval)delay { - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(retrieveRewardsIfNeeded) object:nil]; - [self performSelector:@selector(retrieveRewardsIfNeeded) withObject:nil afterDelay:delay]; -} - #pragma mark - [Private] - (NSString*)applicationURLScheme { @@ -1026,8 +993,4 @@ - (void)notifyRegisterOrigin:(TKBLOriginType)type didFailWithError:(NSError*)err } } -- (void)applicationDidBecomeActive:(NSNotification*)ntf { - [self scheduleRetrieveRewards:0.0]; -} - @end diff --git a/TalkableSDK.podspec b/TalkableSDK.podspec index ed045d0..934e8de 100644 --- a/TalkableSDK.podspec +++ b/TalkableSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "TalkableSDK" - spec.version = "1.4.15" + spec.version = "1.5.1" spec.summary = "Talkable SDK makes it easy to integrate Talkable referral functionality into your apps." spec.description = <<-DESC diff --git a/TalkableSDK.xcodeproj/project.pbxproj b/TalkableSDK.xcodeproj/project.pbxproj index 935728c..8954fac 100644 --- a/TalkableSDK.xcodeproj/project.pbxproj +++ b/TalkableSDK.xcodeproj/project.pbxproj @@ -517,7 +517,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1.4.15; + CURRENT_PROJECT_VERSION = 1.5.1; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -578,7 +578,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1.4.15; + CURRENT_PROJECT_VERSION = 1.5.1; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -609,7 +609,7 @@ CLANG_ENABLE_MODULE_DEBUGGING = YES; CLANG_ENABLE_OBJC_ARC = YES; CREATE_INFOPLIST_SECTION_IN_BINARY = NO; - CURRENT_PROJECT_VERSION = 1.4.15; + CURRENT_PROJECT_VERSION = 1.5.1; DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -623,7 +623,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; - MARKETING_VERSION = 1.4.15; + MARKETING_VERSION = 1.5.1; PRODUCT_BUNDLE_IDENTIFIER = "com.talkable.ios-sdk"; PRODUCT_NAME = TalkableSDK; PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers"; @@ -638,7 +638,7 @@ CLANG_ENABLE_MODULE_DEBUGGING = NO; CLANG_ENABLE_OBJC_ARC = YES; CREATE_INFOPLIST_SECTION_IN_BINARY = NO; - CURRENT_PROJECT_VERSION = 1.4.15; + CURRENT_PROJECT_VERSION = 1.5.1; DEAD_CODE_STRIPPING = YES; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -652,7 +652,7 @@ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MACH_O_TYPE = staticlib; - MARKETING_VERSION = 1.4.15; + MARKETING_VERSION = 1.5.1; PRODUCT_BUNDLE_IDENTIFIER = "com.talkable.ios-sdk"; PRODUCT_NAME = TalkableSDK; PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";