Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update OSIamFetchReadyCondition to sharedInstance to waist on sub update
Motivation: if we have a subscription update enqueued, we need to consider it. Otherwise we should just consider the userUpdateTokenSet.
  • Loading branch information
Rodrigo Gomez Palacio committed Oct 23, 2024
commit 82e468b2884c4fdb8b25f3a8e08fad0f23dc7115
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@objc public static let CONDITIONID: String = "OSIamFetchReadyCondition"

public var conditionId: String {
return OSIamFetchReadyCondition.CONDITIONID
return OSIamFetchReadyCondition.CONDITIONID
}

public func setSubscriptionUpdatePending(value: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ class OSSubscriptionModelStoreListener: OSModelStoreListener {
}

func getUpdateModelDelta(_ args: OSModelChangedArgs) -> OSDelta? {
// The OSIamFetchReadyCondition needs to know whether there is a subscription update pending
// If so, we use this to await (in IAM-fetch) on its respective RYW token to be set. This is necessary
// because we always make a user property update call but we DON'T always make a subscription update call.
// The user update call increases the session_count while the subscription update would update
// something like the app_version. If the app_version hasn't changed since the last session, there
// wouldn't be an update needed (among other system-level properties).
if let onesignalId = OneSignalUserManagerImpl.sharedInstance.user.identityModel.onesignalId {
let condition = OSIamFetchReadyCondition.sharedInstance(withId: onesignalId)
condition.setSubscriptionUpdatePending(value: true)
}

return OSDelta(
name: OS_UPDATE_SUBSCRIPTION_DELTA,
identityModelId: OneSignalUserManagerImpl.sharedInstance.user.identityModel.modelId,
Expand Down