mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
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:
+6
@@ -21,6 +21,7 @@ import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.push.api.PushService
|
||||
import io.element.android.libraries.pushproviders.api.Distributor
|
||||
import io.element.android.libraries.pushproviders.api.PushProvider
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
import io.element.android.tests.testutils.simulateLongTask
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@@ -32,6 +33,7 @@ class FakePushService(
|
||||
Result.success(Unit)
|
||||
},
|
||||
private val currentPushProvider: () -> PushProvider? = { availablePushProviders.firstOrNull() },
|
||||
private val selectPushProviderLambda: suspend (MatrixClient, PushProvider) -> Unit = { _, _ -> lambdaError() }
|
||||
) : PushService {
|
||||
override suspend fun getCurrentPushProvider(): PushProvider? {
|
||||
return registeredPushProvider ?: currentPushProvider()
|
||||
@@ -56,6 +58,10 @@ class FakePushService(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun selectPushProvider(matrixClient: MatrixClient, pushProvider: PushProvider) {
|
||||
selectPushProviderLambda(matrixClient, pushProvider)
|
||||
}
|
||||
|
||||
private val ignoreRegistrationError = MutableStateFlow(false)
|
||||
|
||||
override fun ignoreRegistrationError(sessionId: SessionId): Flow<Boolean> {
|
||||
|
||||
Reference in New Issue
Block a user