Skip to content

Commit 75eab0f

Browse files
author
Rodrigo Gomez Palacio
committed
Clarifying comment re: why we track RYW tokens for user create as well
Motivation: On fresh installs, we don't yet have a user or a subscription to update so we wouldn't get a RYW token until those requests are executed (5 seconds later when the operations are processed)
1 parent 663edc1 commit 75eab0f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchOffsetKey.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
import Foundation
2929

3030
public enum OSIamFetchOffsetKey: Int, OSConsistencyKeyEnum {
31+
// We track user create tokens as well because on fresh installs, we don't have a user or subscription
32+
// to update, which would lead to a 5 second delay until the subsequent user & subscription update calls
33+
// give us RYW tokens
3134
case userCreate = 0
3235
case userUpdate = 1
3336
case subscriptionUpdate = 2

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/Consistency/IamFetch/OSIamFetchReadyCondition.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
public func isMet(indexedTokens: [String: [NSNumber: OSReadYourWriteData]]) -> Bool {
6161
guard let tokenMap = indexedTokens[id] else { return false }
6262

63+
// We track user create tokens as well because on fresh installs, we don't have a user or subscription
64+
// to update, which would lead to a 5 second delay until the subsequent user & subscription update calls
65+
// give us RYW tokens
6366
let userCreateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userCreate.rawValue)] != nil
6467
let userUpdateTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.userUpdate.rawValue)] != nil
6568
let subscriptionTokenSet = tokenMap[NSNumber(value: OSIamFetchOffsetKey.subscriptionUpdate.rawValue)] != nil

0 commit comments

Comments
 (0)