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 return@launch
} }
// By default, use internal solution (fcm/background sync)
UnifiedPush.saveDistributor(context, context.packageName)
val distributors = UnifiedPush.getDistributors(context) val distributors = UnifiedPush.getDistributors(context)
if (distributors.size == 1 && !force) { if (distributors.size == 1 && !force) {
@ -101,7 +99,14 @@ class UnifiedPushHelper @Inject constructor(
UnifiedPush.registerApp(context) UnifiedPush.registerApp(context)
onDoneRunnable?.run() onDoneRunnable?.run()
} else { } 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() onDoneRunnable?.run()
} }
} }
.setOnCancelListener {
// By default, use internal solution (fcm/background sync)
UnifiedPush.saveDistributor(context, context.packageName)
UnifiedPush.registerApp(context)
onDoneRunnable?.run()
}
.setCancelable(cancellable) .setCancelable(cancellable)
.show() .show()
} }