Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[User model] Push Subscription Changed Event #1768

Merged
merged 3 commits into from
May 1, 2023
Merged
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
Fire onSubscriptionChanged event for all subscription types
We only want to fire the changeHandlersNotifier for push subs but the onSubscriptionChanged for all subscriptions.
  • Loading branch information
emawby committed Apr 28, 2023
commit e5a748c52cec3cec82eb51f85ffcaaa81218a506
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,16 @@ internal class SubscriptionManager(
// this shouldn't happen, but create a new subscription if a model was updated and we
// don't yet have a representation for it in the subscription list.
createSubscriptionAndAddToSubscriptionList(args.model as SubscriptionModel)
} else if (subscription is PushSubscription) {
subscription.changeHandlersNotifier.fireOnMain {
it.onPushSubscriptionChange(
PushSubscriptionChangedState(
subscription.savedState,
subscription.refreshState())
)
} else {
if (subscription is PushSubscription) {
subscription.changeHandlersNotifier.fireOnMain {
it.onPushSubscriptionChange(
PushSubscriptionChangedState(
subscription.savedState,
subscription.refreshState())
)
}
}

// the model has already been updated, so fire the update event
_events.fire { it.onSubscriptionChanged(subscription, args) }
}
Expand Down