mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Follow SDK method renaming: fix_recovery_issues() got renamed to recover()
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@ class SecureBackupEnterRecoveryKeyPresenter @Inject constructor(
|
|||||||
action: MutableState<Async<Unit>>
|
action: MutableState<Async<Unit>>
|
||||||
) = launch {
|
) = launch {
|
||||||
suspend {
|
suspend {
|
||||||
encryptionService.fixRecoveryIssues(recoveryKey).getOrThrow()
|
encryptionService.recover(recoveryKey).getOrThrow()
|
||||||
}.runCatchingUpdatingState(action)
|
}.runCatchingUpdatingState(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -73,7 +73,7 @@ class SecureBackupEnterRecoveryKeyPresenterTest {
|
|||||||
inProgress = false,
|
inProgress = false,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
encryptionService.givenFixRecoveryIssuesFailure(AN_EXCEPTION)
|
encryptionService.givenRecoverFailure(AN_EXCEPTION)
|
||||||
withRecoveryKeyState.eventSink(SecureBackupEnterRecoveryKeyEvents.Submit)
|
withRecoveryKeyState.eventSink(SecureBackupEnterRecoveryKeyEvents.Submit)
|
||||||
val loadingState = awaitItem()
|
val loadingState = awaitItem()
|
||||||
assertThat(loadingState.submitAction).isEqualTo(Async.Loading<Unit>())
|
assertThat(loadingState.submitAction).isEqualTo(Async.Loading<Unit>())
|
||||||
@@ -85,7 +85,7 @@ class SecureBackupEnterRecoveryKeyPresenterTest {
|
|||||||
val clearedState = awaitItem()
|
val clearedState = awaitItem()
|
||||||
assertThat(clearedState.submitAction).isEqualTo(Async.Uninitialized)
|
assertThat(clearedState.submitAction).isEqualTo(Async.Uninitialized)
|
||||||
assertThat(clearedState.isSubmitEnabled).isTrue()
|
assertThat(clearedState.isSubmitEnabled).isTrue()
|
||||||
encryptionService.givenFixRecoveryIssuesFailure(null)
|
encryptionService.givenRecoverFailure(null)
|
||||||
clearedState.eventSink(SecureBackupEnterRecoveryKeyEvents.Submit)
|
clearedState.eventSink(SecureBackupEnterRecoveryKeyEvents.Submit)
|
||||||
val loadingState2 = awaitItem()
|
val loadingState2 = awaitItem()
|
||||||
assertThat(loadingState2.submitAction).isEqualTo(Async.Loading<Unit>())
|
assertThat(loadingState2.submitAction).isEqualTo(Async.Loading<Unit>())
|
||||||
|
|||||||
+2
-2
@@ -43,9 +43,9 @@ interface EncryptionService {
|
|||||||
suspend fun doesBackupExistOnServer(): Result<Boolean>
|
suspend fun doesBackupExistOnServer(): Result<Boolean>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: accept bot recoveryKey and passphrase.
|
* Note: accept both recoveryKey and passphrase.
|
||||||
*/
|
*/
|
||||||
suspend fun fixRecoveryIssues(recoveryKey: String): Result<Unit>
|
suspend fun recover(recoveryKey: String): Result<Unit>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait for backup upload steady state.
|
* Wait for backup upload steady state.
|
||||||
|
|||||||
+1
-1
@@ -179,7 +179,7 @@ internal class RustEncryptionService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun fixRecoveryIssues(recoveryKey: String): Result<Unit> = withContext(dispatchers.io) {
|
override suspend fun recover(recoveryKey: String): Result<Unit> = withContext(dispatchers.io) {
|
||||||
runCatching {
|
runCatching {
|
||||||
service.recover(recoveryKey)
|
service.recover(recoveryKey)
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -33,7 +33,7 @@ class FakeEncryptionService : EncryptionService {
|
|||||||
override val enableRecoveryProgressStateFlow: MutableStateFlow<EnableRecoveryProgress> = MutableStateFlow(EnableRecoveryProgress.Starting)
|
override val enableRecoveryProgressStateFlow: MutableStateFlow<EnableRecoveryProgress> = MutableStateFlow(EnableRecoveryProgress.Starting)
|
||||||
private var waitForBackupUploadSteadyStateFlow: Flow<BackupUploadState> = flowOf()
|
private var waitForBackupUploadSteadyStateFlow: Flow<BackupUploadState> = flowOf()
|
||||||
|
|
||||||
private var fixRecoveryIssuesFailure: Exception? = null
|
private var recoverFailure: Exception? = null
|
||||||
private var doesBackupExistOnServerResult: Result<Boolean> = Result.success(true)
|
private var doesBackupExistOnServerResult: Result<Boolean> = Result.success(true)
|
||||||
|
|
||||||
override suspend fun enableBackups(): Result<Unit> = simulateLongTask {
|
override suspend fun enableBackups(): Result<Unit> = simulateLongTask {
|
||||||
@@ -44,8 +44,8 @@ class FakeEncryptionService : EncryptionService {
|
|||||||
disableRecoveryFailure = exception
|
disableRecoveryFailure = exception
|
||||||
}
|
}
|
||||||
|
|
||||||
fun givenFixRecoveryIssuesFailure(exception: Exception?) {
|
fun givenRecoverFailure(exception: Exception?) {
|
||||||
fixRecoveryIssuesFailure = exception
|
recoverFailure = exception
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun disableRecovery(): Result<Unit> = simulateLongTask {
|
override suspend fun disableRecovery(): Result<Unit> = simulateLongTask {
|
||||||
@@ -61,8 +61,8 @@ class FakeEncryptionService : EncryptionService {
|
|||||||
return doesBackupExistOnServerResult
|
return doesBackupExistOnServerResult
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun fixRecoveryIssues(recoveryKey: String): Result<Unit> = simulateLongTask {
|
override suspend fun recover(recoveryKey: String): Result<Unit> = simulateLongTask {
|
||||||
fixRecoveryIssuesFailure?.let { return Result.failure(it) }
|
recoverFailure?.let { return Result.failure(it) }
|
||||||
return Result.success(Unit)
|
return Result.success(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user