Some fixes from Valere about verification

This commit is contained in:
Benoit Marty 2020-11-05 15:33:28 +01:00
parent 6cb4645514
commit 15ad351579
3 changed files with 18 additions and 2 deletions

View File

@ -140,6 +140,12 @@ class SharedSecureStorageViewModel @AssistedInject constructor(
}
private fun handleDoResetAll() {
// as we are going to reset, we'd better cancel all outgoing requests
// if not they could be accepted in the middle of the reset process
// and cause strange use cases
session.cryptoService().verificationService().getExistingVerificationRequest(session.myUserId)?.forEach {
session.cryptoService().verificationService().cancelVerificationRequest(it)
}
_viewEvents.post(SharedSecureStorageViewEvent.ShowResetBottomSheet)
}

View File

@ -237,7 +237,7 @@ class BootstrapCrossSigningTask @Inject constructor(
Timber.d("## BootstrapCrossSigningTask: Creating 4S - Checking megolm backup")
// First ensure that in sync
val serverVersion = awaitCallback<KeysVersionResult?> {
var serverVersion = awaitCallback<KeysVersionResult?> {
session.cryptoService().keysBackupService().getCurrentVersion(it)
}
@ -247,6 +247,16 @@ class BootstrapCrossSigningTask @Inject constructor(
|| (params.setupMode == SetupMode.PASSPHRASE_AND_NEEDED_SECRETS_RESET && !isMegolmBackupSecretKnown)
|| (params.setupMode == SetupMode.HARD_RESET)
if (shouldCreateKeyBackup) {
// clear all existing backups
while (serverVersion != null) {
awaitCallback<Unit> {
session.cryptoService().keysBackupService().deleteBackup(serverVersion!!.version, it)
}
serverVersion = awaitCallback {
session.cryptoService().keysBackupService().getCurrentVersion(it)
}
}
Timber.d("## BootstrapCrossSigningTask: Creating 4S - Create megolm backup")
val creationInfo = awaitCallback<MegolmBackupCreationInfo> {
session.cryptoService().keysBackupService().prepareKeysBackupVersion(null, null, it)

View File

@ -164,7 +164,7 @@ class IncomingVerificationRequestHandler @Inject constructor(
override fun verificationRequestUpdated(pr: PendingVerificationRequest) {
// If an incoming request is readied (by another device?) we should discard the alert
if (pr.isIncoming && (pr.isReady || pr.handledByOtherSession)) {
if (pr.isIncoming && (pr.isReady || pr.handledByOtherSession || pr.cancelConclusion != null)) {
popupAlertManager.cancelAlert(uniqueIdForVerificationRequest(pr))
}
}