Skip to content

Commit 33bbd80

Browse files
committed
mirror subscriptionId to OSResilientStorage on change
Push subscription id writes now hit both shared UserDefaults and the file-backed mirror so the NSE / prewarm callers can read it when UserDefaults is locked. nil resets clear the mirror.
1 parent e05f600 commit 33bbd80

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

iOS_SDK/OneSignalSDK/OneSignalUser/Source/OSSubscriptionModel.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ class OSSubscriptionModel: OSModel {
135135
return
136136
}
137137

138-
// Cache the subscriptionId as it persists across users on the device??
138+
// Cache the subscriptionId to UserDefaults for routine reads, and the OSResilientStorage mirror
139139
OneSignalUserDefaults.initShared().saveString(forKey: OSUD_PUSH_SUBSCRIPTION_ID, withValue: subscriptionId)
140+
OSResilientStorage.setString(subscriptionId ?? "", forKey: OSResilientStorage.keySubscriptionId)
140141

141142
firePushSubscriptionChanged(.subscriptionId(oldValue))
142143
}

0 commit comments

Comments
 (0)