Set the value of currentDistributorName by reading again the value from the service.
This commit is contained in:
parent
bd46321c2a
commit
3349df5a24
3 changed files with 9 additions and 2 deletions
|
|
@ -121,7 +121,6 @@ class NotificationSettingsPresenter @Inject constructor(
|
|||
)
|
||||
.fold(
|
||||
{
|
||||
currentDistributorName = AsyncAction.Success(distributor.name)
|
||||
refreshPushProvider++
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -262,6 +262,7 @@ class NotificationSettingsPresenterTests {
|
|||
val withNewProvider = awaitItem()
|
||||
assertThat(withNewProvider.showChangePushProviderDialog).isFalse()
|
||||
assertThat(withNewProvider.currentPushDistributor).isEqualTo(AsyncAction.Loading)
|
||||
skipItems(1)
|
||||
val lastItem = awaitItem()
|
||||
assertThat(lastItem.currentPushDistributor).isEqualTo(AsyncAction.Success("aDistributorName1"))
|
||||
cancelAndIgnoreRemainingEvents()
|
||||
|
|
|
|||
|
|
@ -30,19 +30,26 @@ class FakePushService(
|
|||
},
|
||||
) : PushService {
|
||||
override suspend fun getCurrentPushProvider(): PushProvider? {
|
||||
return availablePushProviders.firstOrNull()
|
||||
return registeredPushProvider ?: availablePushProviders.firstOrNull()
|
||||
}
|
||||
|
||||
override fun getAvailablePushProviders(): List<PushProvider> {
|
||||
return availablePushProviders
|
||||
}
|
||||
|
||||
private var registeredPushProvider: PushProvider? = null
|
||||
|
||||
override suspend fun registerWith(
|
||||
matrixClient: MatrixClient,
|
||||
pushProvider: PushProvider,
|
||||
distributor: Distributor,
|
||||
): Result<Unit> = simulateLongTask {
|
||||
return registerWithLambda(matrixClient, pushProvider, distributor)
|
||||
.also {
|
||||
if (it.isSuccess) {
|
||||
registeredPushProvider = pushProvider
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun testPush(): Boolean = simulateLongTask {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue