Merge pull request #6890 from vector-im/feature/adm/missing-notifications-on-login

Missing push notifications on login
This commit is contained in:
Adam Brown 2022-08-22 11:14:28 +01:00 committed by GitHub
commit 7211c9c08e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

1
changelog.d/6891.bugfix Normal file
View file

@ -0,0 +1 @@
Fixes missing firebase notifications after logging in when UnifiedPush distributor is installed

View file

@ -92,8 +92,6 @@ class UnifiedPushHelper @Inject constructor(
return@launch
}
// By default, use internal solution (fcm/background sync)
UnifiedPush.saveDistributor(context, context.packageName)
val distributors = UnifiedPush.getDistributors(context)
if (distributors.size == 1 && !force) {
@ -101,7 +99,14 @@ class UnifiedPushHelper @Inject constructor(
UnifiedPush.registerApp(context)
onDoneRunnable?.run()
} else {
openDistributorDialogInternal(activity, pushersManager, onDoneRunnable, distributors, !force, !force)
openDistributorDialogInternal(
activity = activity,
pushersManager = pushersManager,
onDoneRunnable = onDoneRunnable,
distributors = distributors,
unregisterFirst = force,
cancellable = !force
)
}
}
}
@ -165,6 +170,12 @@ class UnifiedPushHelper @Inject constructor(
onDoneRunnable?.run()
}
}
.setOnCancelListener {
// By default, use internal solution (fcm/background sync)
UnifiedPush.saveDistributor(context, context.packageName)
UnifiedPush.registerApp(context)
onDoneRunnable?.run()
}
.setCancelable(cancellable)
.show()
}