Skip to content

Commit

Permalink
release: SDK 1.17.2
Browse files Browse the repository at this point in the history
  • Loading branch information
abarisain committed May 24, 2021
1 parent 76ba975 commit 71d67aa
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ let package = Package(
targets: [
.binaryTarget(
name: "Batch",
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.17.1.zip",
checksum: "d83bf12b86d27c5c803616a07d7822bf9db558f55eb684a111ba95242a7df339"
url: "https://download.batch.com/sdk/ios/spm/BatchSDK-ios_spm-xcframework-1.17.2.zip",
checksum: "e2c08e708008c03cfa3f3aed98aeeda08c46a662b25329ad627c1fc4763a9bc8"
)
]
)
14 changes: 5 additions & 9 deletions Sources/Batch/BatchCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
- Device brand
- Carrier name
- IDFV
Setting this to false have a negative impact on core Batch features
You should only use it if you know what you are doing.
Expand Down Expand Up @@ -164,7 +162,7 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
If you also want to delete user data, please see [Batch optOutAndWipeData].
Calling this method when Batch hasn't started is unsupported.
Calling this method when Batch hasn't started does nothing: Please call [Batch startWithAPIKey:] beforehand.
*/
+ (void)optOut;

Expand All @@ -178,7 +176,7 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
Note that once opted out, [Batch startWithAPIKey:] will essentially be a no-op
Your app should be prepared to handle these cases.
Calling this method when Batch hasn't started is unsupported.
Calling this method when Batch hasn't started does nothing: Please call [Batch startWithAPIKey:] beforehand.
*/
+ (void)optOutAndWipeData;

Expand All @@ -192,7 +190,7 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
Note: if the SDK has already been opted-out from, this method will instantly call the completion handler with a *failure* state.
Calling this method when Batch hasn't started is unsupported.
Calling this method when Batch hasn't started does nothing: Please call [Batch startWithAPIKey:] beforehand.
*/
+ (void)optOutWithCompletionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nonnull)(BOOL success))handler;

Expand All @@ -206,17 +204,15 @@ typedef NS_ENUM(NSUInteger, BatchOptOutNetworkErrorPolicy) {
Note: if the SDK has already been opted-out from, this method will instantly call the completion handler with a *failure* state.
Calling this method when Batch hasn't started is unsupported.
Calling this method when Batch hasn't started does nothing: Please call [Batch startWithAPIKey:] beforehand.
*/
+ (void)optOutAndWipeDataWithCompletionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nonnull)(BOOL success))handler;

/**
Opt-in to Batch SDK.
Useful if you called [Batch optOut], [Batch optOutAndWipeData] or opted out by default in your Info.plist
Some features might not fully work until the next app restart. You will need to call [Batch startWithAPIKey:@""] after this.
Calling this method when Batch hasn't started is unsupported.
You will need to call [Batch startWithAPIKey:@""] after this.
*/
+ (void)optIn;

Expand Down
16 changes: 12 additions & 4 deletions Sources/Batch/BatchCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,23 @@ + (void)setInternalLogsEnabled:(BOOL)enableInternalLogs

+ (void)optOut
{
[[BAOptOut instance] setOptedOut:true wipeData:false completionHandler:nil];
[[BAOptOut instance] setOptedOut:true wipeData:false completionHandler:^BatchOptOutNetworkErrorPolicy(BOOL success) {
return BatchOptOutNetworkErrorPolicyIgnore;
}];
}

+ (void)optOutAndWipeData
{
[[BAOptOut instance] setOptedOut:true wipeData:true completionHandler:nil];
[[BAOptOut instance] setOptedOut:true wipeData:true completionHandler:^BatchOptOutNetworkErrorPolicy(BOOL success) {
return BatchOptOutNetworkErrorPolicyIgnore;
}];
}

+ (void)optOutWithCompletionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nonnull)(BOOL success))handler
{
[[BAOptOut instance] setOptedOut:true wipeData:false completionHandler:handler];
[[BAOptOut instance] setOptedOut:true wipeData:false completionHandler:^BatchOptOutNetworkErrorPolicy(BOOL success) {
return BatchOptOutNetworkErrorPolicyIgnore;
}];
}

+ (void)optOutAndWipeDataWithCompletionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nonnull)(BOOL success))handler
Expand All @@ -94,7 +100,9 @@ + (void)optOutAndWipeDataWithCompletionHandler:(BatchOptOutNetworkErrorPolicy(^

+ (void)optIn
{
[[BAOptOut instance] setOptedOut:false wipeData:false completionHandler:nil];
[[BAOptOut instance] setOptedOut:false wipeData:false completionHandler:^BatchOptOutNetworkErrorPolicy(BOOL success) {
return BatchOptOutNetworkErrorPolicyIgnore;
}];
}

+ (BOOL)isOptedOut
Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/BatchUser.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ typedef NS_ERROR_ENUM(BatchUserDataEditorErrorDomain, BatchUserDataEditorError)
/**
Set the user identifier.
@warning Be careful: you should make sure the identifier uniquely identifies a user. When pushing an identifier, all installations with that identifier will get the Push, which can cause some privacy issues if done wrong. Also affects Unlock offer delivery and restore.
@warning Be careful: you should make sure the identifier uniquely identifies a user. When pushing an identifier, all installations with that identifier will get the Push, which can cause some privacy issues if done wrong.
@param identifier User identifier.
*/
Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/Defined.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if (error == NULL) {\
#define kParametersIDsPatternValue @"s,da,ada,did,cus,tath,dla,dre,dtz,osv,de,apv,apc,bid,pl,lvl,mlvl,pid,plv,brv,attid_e"

#define kParametersAdvancedIDsPatternKey @"app.ids.pattern_advanced"
#define kParametersAdvancedIDsPatternValue @"dty,sop,idfv"
#define kParametersAdvancedIDsPatternValue @"dty,sop"

#define kParametersCustomUserIDKey @"app.id.custom"
#define kParametersAppLanguageKey @"app.language"
Expand Down
15 changes: 2 additions & 13 deletions Sources/Batch/Kernel/Parameters/BAPropertiesCenter.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ - (void)setupParameterMappings
#endif
@"attid_e": @"isAttributionIdEnabled",
@"tath": @"trackingAuthorizationStatus",
@"idfv": @"identifierForVendor",
@"dre": @"deviceRegion",
@"dla": @"deviceLanguage",
@"dtz": @"deviceTimezone",
Expand Down Expand Up @@ -203,16 +202,6 @@ - (NSString *)trackingAuthorizationStatus
return [NSString stringWithFormat:@"%lu", (unsigned long)status];
}

- (NSString *)identifierForVendor
{
if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)])
{
return [[[UIDevice currentDevice] performSelector:@selector(identifierForVendor)] performSelector:@selector(UUIDString)];
}

return nil;
}

// MCC+MNC
- (NSString *)simOperatorCode
{
Expand Down Expand Up @@ -357,7 +346,7 @@ - (NSString *)pluginVersion
const char *pluginVersion = getenv("BATCH_PLUGIN_VERSION");
if (pluginVersion != nil)
{
return [NSString stringWithFormat:@"%@ ",[NSString stringWithCString:pluginVersion encoding:NSUTF8StringEncoding]];
return [NSString stringWithFormat:@"%@",[NSString stringWithCString:pluginVersion encoding:NSUTF8StringEncoding]];
}

return nil;
Expand All @@ -368,7 +357,7 @@ - (NSString *)bridgeVersion
const char *bridgeVersion = getenv("BATCH_BRIDGE_VERSION");
if (bridgeVersion != nil)
{
return [NSString stringWithFormat:@"%@ ",[NSString stringWithCString:bridgeVersion encoding:NSUTF8StringEncoding]];
return [NSString stringWithFormat:@"%@",[NSString stringWithCString:bridgeVersion encoding:NSUTF8StringEncoding]];
}

return nil;
Expand Down
1 change: 0 additions & 1 deletion Sources/Batch/Modules/Core/BACoreCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@
- Device model
- Device brand
- Carrier name
- IDFV
Setting this to false have a negative impact on core Batch features
You should only use it if you know what you are doing.
Expand Down
9 changes: 9 additions & 0 deletions Sources/Batch/Modules/Core/BATrackingAuthorization.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ - (NSUUID*)attributionIdentifier {
return nil;
}

#if !TARGET_OS_MACCATALYST
if (@available(iOS 14.5, *)) {
if (ATTrackingManager.trackingAuthorizationStatus != ATTrackingManagerAuthorizationStatusAuthorized) {
[BALogger debugForDomain:@"TAth" message:@"Skipping attribution identifier, disallowed by ATT."];
return nil;
}
}
#endif

SEL selector = NSSelectorFromString([NSString stringWithFormat:@"%@Id%@",@"advertising",@"entifier"]);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
Expand Down
4 changes: 0 additions & 4 deletions Sources/Batch/Modules/Debug/BADBGIdentifiersViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ - (void)fetchIdentifiers
[temporaryIdentifiers addObject:[BADBGNameValueListItem itemWithName:@"Push Token" value:(pushToken != nil ? pushToken : @"none")]];
[temporaryIdentifiers addObject:[BADBGNameValueListItem itemWithName:@"APNS Environment" value:([BABundleInfo usesAPNSandbox] ? @"Sandbox" : @"Production")]];

#if BATCH_ENABLE_IDFA
[temporaryIdentifiers addObject:[BADBGNameValueListItem itemWithName:@"IDFA" value:[BAPropertiesCenter valueForShortName:@"idfa"]]];
#endif

_identifiers = temporaryIdentifiers;

/* Todo: add application info, such as bundle id and version*/
Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/Modules/Inbox/BAInbox.m
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ - (void)fetchFromWSForCursor:(NSString*)cursor callback:(void (^ _Nonnull)(NSErr
if (_fetcherId != -1) {
NSArray<BAInboxCandidateNotification*> *candidates = [[BAInjection injectProtocol:@protocol(BAInboxDatasourceProtocol)] candidateNotificationsFromCursor:cursor limit:self.maxPageSize fetcherId:_fetcherId];
if ([candidates count] > 0) {
[self syncFromWSForCursor:self->_cursor candidates:candidates callback:callback];
[self syncFromWSForCursor:cursor candidates:candidates callback:callback];
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/Modules/Inbox/BAInboxSyncWebserviceClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ -(void)handleCache:(NSDictionary *)cache
NSNumber *cacheMarkAllAsRead = [cache objectForKey:@"lastMarkAllAsRead"];
if (![BANullHelper isNumberEmpty:cacheMarkAllAsRead])
{
[[BAInjection injectProtocol:@protocol(BAInboxDatasourceProtocol)] markAllAsRead:[cacheMarkAllAsRead longLongValue] withFetcherId:_fetcherId];
[[BAInjection injectProtocol:@protocol(BAInboxDatasourceProtocol)] markAllAsRead:([cacheMarkAllAsRead longLongValue] / 1000) withFetcherId:_fetcherId];
}

NSArray *delete = [cache objectForKey:@"delete"];
Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/Modules/Opt Out/BAOptOut.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern NSString * _Nonnull const kBATOptOutWipeDataKey;

+ (nonnull BAOptOut *)instance;

- (void)setOptedOut:(BOOL)newVal wipeData:(BOOL)wipeData completionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nullable)(BOOL success))handler;
- (void)setOptedOut:(BOOL)newVal wipeData:(BOOL)wipeData completionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nonnull)(BOOL success))handler;

- (BOOL)isOptedOut;

Expand Down
2 changes: 1 addition & 1 deletion Sources/Batch/Modules/Opt Out/BAOptOut.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ - (void)setEventTracker:(BAOptOutEventTracker*)eventTracker
_eventTracker = eventTracker;
}

- (void)setOptedOut:(BOOL)shouldOptOut wipeData:(BOOL)wipeData completionHandler:(BatchOptOutNetworkErrorPolicy(^)(BOOL success))completionHandler
- (void)setOptedOut:(BOOL)shouldOptOut wipeData:(BOOL)wipeData completionHandler:(BatchOptOutNetworkErrorPolicy(^ _Nonnull)(BOOL success))completionHandler
{
[self initEventTrackerIfNeeded];

Expand Down
4 changes: 2 additions & 2 deletions Sources/Batch/Versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
Comments should not use the // form, as the plist preprocessor will include them
*/

#define BASDKVersion 1.17.1
#define BAAPILevel 35
#define BASDKVersion 1.17.2
#define BAAPILevel 36
#define BAMessagingAPILevel 10
6 changes: 3 additions & 3 deletions Sources/batchTests/Modules/Core/batchOptOutTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ - (void)testPublicAPI {
OCMStub([optOutMock instance]).andReturn(optOutMock);

[Batch optOut];
OCMVerify([optOutMock setOptedOut:true wipeData:false completionHandler:nil]);
OCMVerify([optOutMock setOptedOut:true wipeData:false completionHandler:[OCMArg any]]);

[Batch optIn];
OCMVerify([optOutMock setOptedOut:false wipeData:false completionHandler:nil]);
OCMVerify([optOutMock setOptedOut:false wipeData:false completionHandler:[OCMArg any]]);

[Batch optOutAndWipeData];
OCMVerify([optOutMock setOptedOut:true wipeData:true completionHandler:nil]);
OCMVerify([optOutMock setOptedOut:true wipeData:true completionHandler:[OCMArg any]]);

[Batch optOutWithCompletionHandler:^BatchOptOutNetworkErrorPolicy(BOOL success) {
return BatchOptOutNetworkErrorPolicyCancel;
Expand Down

0 comments on commit 71d67aa

Please sign in to comment.