code review
This commit is contained in:
parent
5a323db7dc
commit
8077406cba
|
@ -24,7 +24,6 @@ import org.junit.Assert.assertNotNull
|
|||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.FixMethodOrder
|
||||
import org.junit.Ignore
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.MethodSorters
|
||||
|
@ -63,7 +62,6 @@ class KeysBackupTest : InstrumentedTest {
|
|||
*/
|
||||
@Test
|
||||
fun roomKeysTest_testBackupStore_ok() {
|
||||
|
||||
val testHelper = CommonTestHelper(context())
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
|
||||
|
@ -105,7 +103,6 @@ class KeysBackupTest : InstrumentedTest {
|
|||
*/
|
||||
@Test
|
||||
fun prepareKeysBackupVersionTest() {
|
||||
|
||||
val testHelper = CommonTestHelper(context())
|
||||
val cryptoTestHelper = CryptoTestHelper(testHelper)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||
* Copyright 2022 The Matrix.org Foundation C.I.C.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -347,7 +347,6 @@ internal class DefaultKeysBackupService @Inject constructor(
|
|||
|
||||
override fun backupAllGroupSessions(progressListener: ProgressListener?,
|
||||
callback: MatrixCallback<Unit>?) {
|
||||
|
||||
if (!isEnabled || backupOlmPkEncryption == null || keysBackupVersion == null) {
|
||||
callback?.onFailure(Throwable("Backup not enabled"))
|
||||
return
|
||||
|
|
|
@ -98,9 +98,8 @@ class KeysBackupManageActivity : SimpleFragmentActivity() {
|
|||
is KeysBackupViewEvents.RequestStore4SSecret -> {
|
||||
secretStartForActivityResult.launch(
|
||||
SharedSecureStorageActivity.newWriteIntent(
|
||||
this,
|
||||
null, // default key
|
||||
listOf(KEYBACKUP_SECRET_SSSS_NAME to it.recoveryKey)
|
||||
context = this,
|
||||
writeSecrets = listOf(KEYBACKUP_SECRET_SSSS_NAME to it.recoveryKey)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -156,14 +156,20 @@ class KeysBackupSettingsViewModel @AssistedInject constructor(@Assisted initialS
|
|||
|
||||
suspend fun completeBackupCreation() {
|
||||
val info = pendingBackupCreationInfo ?: return
|
||||
try {
|
||||
val version = awaitCallback<KeysVersion> {
|
||||
session.cryptoService().keysBackupService().createKeysBackupVersion(info, it)
|
||||
}
|
||||
// Save it for gossiping
|
||||
Timber.d("## BootstrapCrossSigningTask: Creating 4S - Save megolm backup key for gossiping")
|
||||
session.cryptoService().keysBackupService().saveBackupRecoveryKey(info.recoveryKey, version = version.version)
|
||||
} catch (failure: Throwable) {
|
||||
// XXX mm... failed we should remove what we put in 4S, as it was not created?
|
||||
|
||||
// TODO catch, delete 4S account data
|
||||
// for now just stay on the screen, user can retry, there is no api to delete account data
|
||||
} finally {
|
||||
pendingBackupCreationInfo = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteCurrentBackup() {
|
||||
|
|
Loading…
Reference in New Issue