Wait for UnifiedPush pusher to be registered before returning Result.

This commit is contained in:
Benoit Marty 2024-05-07 13:06:54 +02:00 committed by Benoit Marty
parent 2a20044cc7
commit d459c0806b
4 changed files with 87 additions and 8 deletions

View file

@ -67,13 +67,13 @@ class DefaultPushService @Inject constructor(
pushProviders.find { it.name == currentPushProviderName }?.unregister(matrixClient)
?.onFailure {
Timber.w(it, "Failed to unregister previous push provider")
return Result.failure(it)
}
}
// Store new value
userPushStore.setPushProviderName(pushProvider.name)
// Then try to register
return pushProvider.registerWith(matrixClient, distributor)
.onSuccess {
// Store new value
userPushStore.setPushProviderName(pushProvider.name)
}
}
override suspend fun testPush(): Boolean {