Skip to content

Commit 94dd9b4

Browse files
authored
Fix Send Tags Issue (#332)
• Fixes an issue where if a developer sends tags within 30 seconds of the app being launched for the first time (before registration happens), the tags callbacks will not get called when the tags do eventually get sent (during registration).
1 parent 4624a2c commit 94dd9b4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

iOS_SDK/OneSignalSDK/Source/OneSignal.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,9 +1039,14 @@ + (void)registerUserInternal {
10391039
if (releaseMode == UIApplicationReleaseDev || releaseMode == UIApplicationReleaseAdHoc || releaseMode == UIApplicationReleaseWildcard)
10401040
dataDic[@"test_type"] = [NSNumber numberWithInt:releaseMode];
10411041

1042+
NSArray* nowProcessingCallbacks;
1043+
10421044
if (tagsToSend) {
10431045
dataDic[@"tags"] = tagsToSend;
10441046
tagsToSend = nil;
1047+
1048+
nowProcessingCallbacks = pendingSendTagCallbacks;
1049+
pendingSendTagCallbacks = nil;
10451050
}
10461051

10471052
[OneSignal onesignal_Log:ONE_S_LL_VERBOSE message:@"Calling OneSignal create/on_session"];
@@ -1068,6 +1073,12 @@ + (void)registerUserInternal {
10681073
[[NSUserDefaults standardUserDefaults] setObject:self.currentSubscriptionState.userId forKey:@"GT_PLAYER_ID"];
10691074
[[NSUserDefaults standardUserDefaults] synchronize];
10701075

1076+
if (nowProcessingCallbacks) {
1077+
for (OSPendingCallbacks *callbackSet in nowProcessingCallbacks) {
1078+
callbackSet.successBlock(dataDic[@"tags"]);
1079+
}
1080+
}
1081+
10711082
if (self.currentSubscriptionState.pushToken)
10721083
[self updateDeviceToken:self.currentSubscriptionState.pushToken
10731084
onSuccess:tokenUpdateSuccessBlock
@@ -1101,6 +1112,12 @@ + (void)registerUserInternal {
11011112

11021113
//If the failed registration is priority, force the next one to be a high priority
11031114
nextRegistrationIsHighPriority = YES;
1115+
1116+
if (nowProcessingCallbacks) {
1117+
for (OSPendingCallbacks *callbackSet in nowProcessingCallbacks) {
1118+
callbackSet.failureBlock(error);
1119+
}
1120+
}
11041121
}];
11051122
}
11061123

0 commit comments

Comments
 (0)