clean unnecessary safe calls error

This commit is contained in:
Valere 2021-11-25 16:03:47 +01:00
parent 8bebcc93e7
commit c4bddadebb

View file

@ -164,7 +164,7 @@ internal class DefaultCryptoService @Inject constructor(
EventType.STATE_ROOM_MEMBER -> onRoomMembershipEvent(roomId, event) EventType.STATE_ROOM_MEMBER -> onRoomMembershipEvent(roomId, event)
EventType.STATE_ROOM_HISTORY_VISIBILITY -> onRoomHistoryVisibilityEvent(roomId, event) EventType.STATE_ROOM_HISTORY_VISIBILITY -> onRoomHistoryVisibilityEvent(roomId, event)
else -> cryptoCoroutineScope.launch { else -> cryptoCoroutineScope.launch {
this@DefaultCryptoService.verificationService?.onEvent(event) this@DefaultCryptoService.verificationService.onEvent(event)
} }
} }
} }
@ -701,7 +701,7 @@ internal class DefaultCryptoService @Inject constructor(
// The rust-sdk will clear this event if it's invalid, this will produce an invalid base64 error // The rust-sdk will clear this event if it's invalid, this will produce an invalid base64 error
// when we try to construct the recovery key. // when we try to construct the recovery key.
val secretContent = event.getClearContent().toModel<SecretSendEventContent>() ?: return@forEach val secretContent = event.getClearContent().toModel<SecretSendEventContent>() ?: return@forEach
this.keysBackupService?.onSecretKeyGossip(secretContent.secretValue) this.keysBackupService.onSecretKeyGossip(secretContent.secretValue)
} }
else -> { else -> {
this.verificationService.onEvent(event) this.verificationService.onEvent(event)
@ -753,7 +753,7 @@ internal class DefaultCryptoService @Inject constructor(
// If we sent out a room key over to-device messages it's likely that we created a new one // If we sent out a room key over to-device messages it's likely that we created a new one
// Try to back the key up // Try to back the key up
if (sharedKey) { if (sharedKey) {
keysBackupService?.maybeBackupKeys() keysBackupService.maybeBackupKeys()
} }
} }
@ -868,8 +868,8 @@ internal class DefaultCryptoService @Inject constructor(
override suspend fun importRoomKeys(roomKeysAsArray: ByteArray, override suspend fun importRoomKeys(roomKeysAsArray: ByteArray,
password: String, password: String,
progressListener: ProgressListener?): ImportRoomKeysResult { progressListener: ProgressListener?): ImportRoomKeysResult {
val result = olmMachine!!.importKeys(roomKeysAsArray, password, progressListener) val result = olmMachine.importKeys(roomKeysAsArray, password, progressListener)
keysBackupService?.maybeBackupKeys() keysBackupService.maybeBackupKeys()
return result return result
} }