diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchOffsetKey.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchOffsetKey.swift index 915f7b275..c14a5f73f 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchOffsetKey.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchOffsetKey.swift @@ -28,6 +28,9 @@ import Foundation public enum OSIamFetchOffsetKey: Int, OSConsistencyKeyEnum { + // We track user create tokens as well because on fresh installs, we don't have a user or subscription + // to update, which would lead to a 5 second delay until the subsequent user & subscription update calls + // give us RYW tokens case userCreate = 0 case userUpdate = 1 case subscriptionUpdate = 2 diff --git a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchReadyCondition.swift b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchReadyCondition.swift index b915de506..66751e3a0 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchReadyCondition.swift +++ b/iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchReadyCondition.swift @@ -60,6 +60,9 @@ public func isMet(indexedTokens: [String: [NSNumber: OSReadYourWriteData]]) -> Bool { guard let tokenMap = indexedTokens[id] else { return false } + // We track user create tokens as well because on fresh installs, we don't have a user or subscription + // to update, which would lead to a 5 second delay until the subsequent user & subscription update calls + // give us RYW tokens let userCreateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userCreate.rawValue)] != nil let userUpdateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userUpdate.rawValue)] != nil let subscriptionTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.subscriptionUpdate.rawValue)] != nil