Skip to content

Commit

Permalink
Update OSIamFetchReadyCondition to sharedInstance to waist on sub update
Browse files Browse the repository at this point in the history
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 10, 2024
1 parent d7ff1f6 commit 0e56de3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,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,11 @@ class OSSubscriptionModelStoreListener: OSModelStoreListener {
}

func getUpdateModelDelta(_ args: OSModelChangedArgs) -> OSDelta? {
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

0 comments on commit 0e56de3

Please sign in to comment.