Skip to content

Commit

Permalink
fix onSubscriptionChanged not firing for local-
Browse files Browse the repository at this point in the history
This is a common case where updates (such as optedIn) should
still propagate even if we haven't sent the POST /users create
call yet. Motivation for this test was a bug was discovered
where calling OneSignal.User.pushSubscription.optIn() was not
prompting for notification permission if it was called before
the create User network call finished.
  • Loading branch information
jkasten2 committed Mar 28, 2024
1 parent d8bcc7b commit a92bcee
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ internal class SubscriptionManager(
args: ModelChangedArgs,
tag: String,
) {
val subscription = subscriptions.collection.firstOrNull { it.id == args.model.id }
val subscription =
subscriptions.collection.firstOrNull {
args.model == (it as Subscription).model
}

if (subscription == null) {
// this shouldn't happen, but create a new subscription if a model was updated and we
Expand Down

0 comments on commit a92bcee

Please sign in to comment.