Skip to content

Commit eb049f4

Browse files
committed
Save push subscription ID on app start
Because of a bug prior to v5.0.5, players that upgraded from v3 -> v5 were missing the player ID in cache for sending to notification opened and notification received endpoints. Now, every time app cold starts, as part of the push subscription model checking itself for updates, we will cache its subscription ID if non-empty.
1 parent 7ec4d9c commit eb049f4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ extension OSSubscriptionModel {
425425
netType = OSNetworkingUtils.getNetType() as? Int
426426
// sdkType ??
427427
// isRooted ??
428+
if type == .push && !(subscriptionId ?? "").isEmpty {
429+
OneSignalUserDefaults.initShared().saveString(forKey: OSUD_PUSH_SUBSCRIPTION_ID, withValue: subscriptionId)
430+
}
428431
}
429432

430433
enum OSPushPropertyChanged {

0 commit comments

Comments
 (0)