diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift index 94aa899e0..74ad0826c 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift @@ -258,7 +258,13 @@ class OSPropertyOperationExecutor: OSOperationExecutor { if let onesignalId = request.identityModel.onesignalId { if let rywToken = response?["ryw_token"] as? String { - OSConsistencyManager.shared.setRywToken(id: onesignalId, key: OSIamFetchOffsetKey.userUpdate, value: rywToken) + let rywDelay = response?["ryw_delay"] as? NSNumber + + OSConsistencyManager.shared.setRywTokenAndDelay( + id: onesignalId, + key: OSIamFetchOffsetKey.userUpdate, + value: OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay) + ) } else { // handle a potential regression where ryw_token is no longer returned by API OSConsistencyManager.shared.resolveConditionsWithID(id: OSIamFetchReadyCondition.CONDITIONID) diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift index 7c8c64aab..2ef43dafc 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSSubscriptionOperationExecutor.swift @@ -301,7 +301,12 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor { if let onesignalId = request.identityModel.onesignalId { if let rywToken = response["ryw_token"] as? String { - OSConsistencyManager.shared.setRywToken(id: onesignalId, key: OSIamFetchOffsetKey.subscriptionUpdate, value: rywToken) + let rywDelay = response["ryw_delay"] as? NSNumber + OSConsistencyManager.shared.setRywTokenAndDelay( + id: onesignalId, + key: OSIamFetchOffsetKey.subscriptionUpdate, + value: OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay) + ) } else { // handle a potential regression where ryw_token is no longer returned by API OSConsistencyManager.shared.resolveConditionsWithID(id: OSIamFetchReadyCondition.CONDITIONID) @@ -416,9 +421,14 @@ class OSSubscriptionOperationExecutor: OSOperationExecutor { } if let onesignalId = OneSignalUserManagerImpl.sharedInstance.onesignalId { - if let rywToken = response?["ryw_token"] as? String + if let rywToken = response?["ryw_token"] as? String { - OSConsistencyManager.shared.setRywToken(id: onesignalId, key: OSIamFetchOffsetKey.subscriptionUpdate, value: rywToken) + let rywDelay = response?["ryw_delay"] as? NSNumber + OSConsistencyManager.shared.setRywTokenAndDelay( + id: onesignalId, + key: OSIamFetchOffsetKey.subscriptionUpdate, + value: OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay) + ) } else { // handle a potential regression where ryw_token is no longer returned by API OSConsistencyManager.shared.resolveConditionsWithID(id: OSIamFetchReadyCondition.CONDITIONID) diff --git a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift index e8606484c..2bc072dcb 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSUserExecutor.swift @@ -262,7 +262,12 @@ extension OSUserExecutor { if let onesignalId = request.identityModel.onesignalId { if let rywToken = response["ryw_token"] as? String { - OSConsistencyManager.shared.setRywToken(id: onesignalId, key: OSIamFetchOffsetKey.userCreate, value: rywToken) + let rywDelay = response["ryw_delay"] as? NSNumber + OSConsistencyManager.shared.setRywTokenAndDelay( + id: onesignalId, + key: OSIamFetchOffsetKey.userCreate, + value: OSReadYourWriteData(rywToken: rywToken, rywDelay: rywDelay) + ) } else { // handle a potential regression where ryw_token is no longer returned by API OSConsistencyManager.shared.resolveConditionsWithID(id: OSIamFetchReadyCondition.CONDITIONID)