Store the first provider even if no distributor is available, else error in troubleshoot test will not be accurate.

Also when registering for the first time, pick the fist available provider with at least one distributor.
This commit is contained in:
Benoit Marty 2024-06-17 17:36:39 +02:00
parent 90eeb6cdb1
commit 622cc35616
4 changed files with 33 additions and 2 deletions

View file

@ -73,6 +73,15 @@ class DefaultPushService @Inject constructor(
return pushProvider.registerWith(matrixClient, distributor)
}
override suspend fun selectPushProvider(
matrixClient: MatrixClient,
pushProvider: PushProvider,
) {
Timber.d("Select ${pushProvider.name}")
val userPushStore = userPushStoreFactory.getOrCreate(matrixClient.sessionId)
userPushStore.setPushProviderName(pushProvider.name)
}
override fun ignoreRegistrationError(sessionId: SessionId): Flow<Boolean> {
return userPushStoreFactory.getOrCreate(sessionId).ignoreRegistrationError()
}