Skip to content

Commit

Permalink
[PR-16122] Remove TKBLDidReceiveReward notification (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtv authored Jun 29, 2023
1 parent 317969e commit 5278a14
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 57 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
]
```

Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions Talkable/TKBLConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -96,4 +96,3 @@ FOUNDATION_EXPORT NSString* TKBLShareRecipients;
FOUNDATION_EXPORT NSString* TKBLShareImage;

FOUNDATION_EXPORT NSString* TKBLProductKey;

4 changes: 2 additions & 2 deletions Talkable/TKBLConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "TKBLConstants.h"

NSString* TKBLVersion = @"1.4.15";
NSString* TKBLVersion = @"1.5.1";

NSString* TKBLErrorDomain = @"com.talkable.ios-sdk";

Expand All @@ -23,7 +23,7 @@
NSString* TKBLMessageCouponIssued = @"coupon_issued";

NSString* TKBLDidReceiveCouponCode = @"TKBLDidReceiveCouponCodeNotificationName";
NSString* TKBLDidReceiveReward = @"TKBLDidReceiveRewordNotificationName";
NSString* TKBLDidReceiveReward = @"TKBLDidReceiveRewordNotificationName"; // deprecated

NSString* TKBLOriginKey = @"o";
NSString* TKBLOriginTypeKey = @"type";
Expand Down
47 changes: 5 additions & 42 deletions Talkable/Talkable.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -588,7 +578,6 @@ - (void)registerInstallIfNeeded {
[self retryRegisterInstall];
} else {
[TKBLHelper registerInstall];
[self scheduleRetrieveRewards:0.0];
}
}];
}
Expand All @@ -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 {
Expand Down Expand Up @@ -1026,8 +993,4 @@ - (void)notifyRegisterOrigin:(TKBLOriginType)type didFailWithError:(NSError*)err
}
}

- (void)applicationDidBecomeActive:(NSNotification*)ntf {
[self scheduleRetrieveRewards:0.0];
}

@end
2 changes: 1 addition & 1 deletion TalkableSDK.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions TalkableSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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";
Expand Down

0 comments on commit 5278a14

Please sign in to comment.