Skip to content

Commit

Permalink
Merge pull request #1345 from OneSignal/fix_send_player_id_to_notific…
Browse files Browse the repository at this point in the history
…ations_requests

Fix legacy player ID was not cached properly when upgrading from v3
  • Loading branch information
nan-li authored Dec 1, 2023
2 parents 95f2c0e + eb049f4 commit 72c2e17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ extension OSSubscriptionModel {
netType = OSNetworkingUtils.getNetType() as? Int
// sdkType ??
// isRooted ??
if type == .push && !(subscriptionId ?? "").isEmpty {
OneSignalUserDefaults.initShared().saveString(forKey: OSUD_PUSH_SUBSCRIPTION_ID, withValue: subscriptionId)
}
}

enum OSPushPropertyChanged {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public class OneSignalUserManagerImpl: NSObject, OneSignalUserManager {
if let legacyPlayerId = OneSignalUserDefaults.initShared().getSavedString(forKey: OSUD_LEGACY_PLAYER_ID, defaultValue: nil) {
OneSignalLog.onesignalLog(.LL_DEBUG, message: "OneSignalUserManager: creating user linked to legacy subscription \(legacyPlayerId)")
createUserFromLegacyPlayer(legacyPlayerId)
OneSignalUserDefaults.initShared().saveString(forKey: OSUD_PUSH_SUBSCRIPTION_ID, withValue: legacyPlayerId)
OneSignalUserDefaults.initStandard().removeValue(forKey: OSUD_LEGACY_PLAYER_ID)
OneSignalUserDefaults.initShared().removeValue(forKey: OSUD_LEGACY_PLAYER_ID)
} else {
Expand Down

0 comments on commit 72c2e17

Please sign in to comment.