UnifiedPush: emit error when registration fails.
Note that I did not manage to have the method `onRegistrationFailed` invoked. If the network is not available for instance, unregistering the previous pusher will fail first.
This commit is contained in:
parent
6b7e8f72f5
commit
f9c0b9e8bb
16 changed files with 208 additions and 23 deletions
|
|
@ -10,6 +10,7 @@ package io.element.android.libraries.push.test
|
|||
|
||||
import io.element.android.libraries.matrix.api.MatrixClient
|
||||
import io.element.android.libraries.matrix.api.core.SessionId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.push.api.PushService
|
||||
import io.element.android.libraries.push.api.history.PushHistoryItem
|
||||
import io.element.android.libraries.pushproviders.api.Distributor
|
||||
|
|
@ -30,6 +31,7 @@ class FakePushService(
|
|||
private val setIgnoreRegistrationErrorLambda: (SessionId, Boolean) -> Unit = { _, _ -> lambdaError() },
|
||||
private val resetPushHistoryResult: () -> Unit = { lambdaError() },
|
||||
private val resetBatteryOptimizationStateResult: () -> Unit = { lambdaError() },
|
||||
private val onServiceUnregisteredResult: (UserId) -> Unit = { lambdaError() },
|
||||
) : PushService {
|
||||
override suspend fun getCurrentPushProvider(sessionId: SessionId): PushProvider? {
|
||||
return registeredPushProvider ?: currentPushProvider(sessionId)
|
||||
|
|
@ -98,4 +100,8 @@ class FakePushService(
|
|||
override suspend fun resetBatteryOptimizationState() {
|
||||
resetBatteryOptimizationStateResult()
|
||||
}
|
||||
|
||||
override suspend fun onServiceUnregistered(userId: UserId) {
|
||||
onServiceUnregisteredResult(userId)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue