Skip to content

Commit cebf1de

Browse files
author
Rodrigo Gomez Palacio
committed
Add note on why lexicographic evaluation works for RYW tokens
Motivation: add clarity on why the method maxOrNull (which uses lexicographic evaulation for strings) works for this use case.
1 parent d3bd67f commit cebf1de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

OneSignalSDK/onesignal/core/src/main/java/com/onesignal/common/consistency/IamFetchReadyCondition.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ class IamFetchReadyCondition(
3636
override fun getRywData(indexedTokens: Map<String, Map<IConsistencyKeyEnum, RywData?>>): RywData? {
3737
val tokenMap = indexedTokens[key] ?: return null
3838

39-
// Collect non-null RywData objects and find the one with the largest rywToken lexicographically
39+
/**
40+
* Collect non-null RywData objects and find the one with the largest rywToken lexicographically
41+
* Note: this works because RYW tokens are always the same length
42+
*/
4043
return listOfNotNull(
4144
tokenMap[IamFetchRywTokenKey.USER],
4245
tokenMap[IamFetchRywTokenKey.SUBSCRIPTION],

0 commit comments

Comments
 (0)