Follow SDK method renaming: fix_recovery_issues() got renamed to recover()
This commit is contained in:
@@ -89,7 +89,7 @@ class SecureBackupEnterRecoveryKeyPresenter @Inject constructor(
|
||||
action: MutableState<Async<Unit>>
|
||||
) = launch {
|
||||
suspend {
|
||||
encryptionService.fixRecoveryIssues(recoveryKey).getOrThrow()
|
||||
encryptionService.recover(recoveryKey).getOrThrow()
|
||||
}.runCatchingUpdatingState(action)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class SecureBackupEnterRecoveryKeyPresenterTest {
|
||||
inProgress = false,
|
||||
)
|
||||
)
|
||||
encryptionService.givenFixRecoveryIssuesFailure(AN_EXCEPTION)
|
||||
encryptionService.givenRecoverFailure(AN_EXCEPTION)
|
||||
withRecoveryKeyState.eventSink(SecureBackupEnterRecoveryKeyEvents.Submit)
|
||||
val loadingState = awaitItem()
|
||||
assertThat(loadingState.submitAction).isEqualTo(Async.Loading<Unit>())
|
||||
@@ -85,7 +85,7 @@ class SecureBackupEnterRecoveryKeyPresenterTest {
|
||||
val clearedState = awaitItem()
|
||||
assertThat(clearedState.submitAction).isEqualTo(Async.Uninitialized)
|
||||
assertThat(clearedState.isSubmitEnabled).isTrue()
|
||||
encryptionService.givenFixRecoveryIssuesFailure(null)
|
||||
encryptionService.givenRecoverFailure(null)
|
||||
clearedState.eventSink(SecureBackupEnterRecoveryKeyEvents.Submit)
|
||||
val loadingState2 = awaitItem()
|
||||
assertThat(loadingState2.submitAction).isEqualTo(Async.Loading<Unit>())
|
||||
|
||||
@@ -43,9 +43,9 @@ interface EncryptionService {
|
||||
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.
|
||||
|
||||
@@ -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 {
|
||||
service.recover(recoveryKey)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class FakeEncryptionService : EncryptionService {
|
||||
override val enableRecoveryProgressStateFlow: MutableStateFlow<EnableRecoveryProgress> = MutableStateFlow(EnableRecoveryProgress.Starting)
|
||||
private var waitForBackupUploadSteadyStateFlow: Flow<BackupUploadState> = flowOf()
|
||||
|
||||
private var fixRecoveryIssuesFailure: Exception? = null
|
||||
private var recoverFailure: Exception? = null
|
||||
private var doesBackupExistOnServerResult: Result<Boolean> = Result.success(true)
|
||||
|
||||
override suspend fun enableBackups(): Result<Unit> = simulateLongTask {
|
||||
@@ -44,8 +44,8 @@ class FakeEncryptionService : EncryptionService {
|
||||
disableRecoveryFailure = exception
|
||||
}
|
||||
|
||||
fun givenFixRecoveryIssuesFailure(exception: Exception?) {
|
||||
fixRecoveryIssuesFailure = exception
|
||||
fun givenRecoverFailure(exception: Exception?) {
|
||||
recoverFailure = exception
|
||||
}
|
||||
|
||||
override suspend fun disableRecovery(): Result<Unit> = simulateLongTask {
|
||||
@@ -61,8 +61,8 @@ class FakeEncryptionService : EncryptionService {
|
||||
return doesBackupExistOnServerResult
|
||||
}
|
||||
|
||||
override suspend fun fixRecoveryIssues(recoveryKey: String): Result<Unit> = simulateLongTask {
|
||||
fixRecoveryIssuesFailure?.let { return Result.failure(it) }
|
||||
override suspend fun recover(recoveryKey: String): Result<Unit> = simulateLongTask {
|
||||
recoverFailure?.let { return Result.failure(it) }
|
||||
return Result.success(Unit)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user