code review

This commit is contained in:
Valere 2019-07-03 18:17:36 +02:00 committed by Benoit Marty
parent 031c4e5746
commit 4041e2e8ca
3 changed files with 7 additions and 13 deletions

View File

@ -840,7 +840,7 @@ internal class CryptoManager @Inject constructor(
val roomKeys = MXMegolmExportEncryption.decryptMegolmKeyFile(roomKeysAsArray, password)
val t1 = System.currentTimeMillis()
Timber.v("""## importRoomKeys : decryptMegolmKeyFile done in ${t1 - t0} ms""")
Timber.v("## importRoomKeys : decryptMegolmKeyFile done in ${t1 - t0} ms")
val importedSessions = MoshiProvider.providesMoshi()
.adapter<List<MegolmSessionData>>(Types.newParameterizedType(List::class.java, MegolmSessionData::class.java))
@ -848,7 +848,7 @@ internal class CryptoManager @Inject constructor(
val t2 = System.currentTimeMillis()
Timber.v("""## importRoomKeys : JSON parsing ${t2 - t1} ms""")
Timber.v("## importRoomKeys : JSON parsing ${t2 - t1} ms")
if (importedSessions == null) {
throw Exception("Error")
@ -1000,9 +1000,9 @@ internal class CryptoManager @Inject constructor(
val requestBody = RoomKeyRequestBody()
requestBody.roomId = event.roomId
requestBody.algorithm = wireContent["algorithm"].toString()
requestBody.senderKey = wireContent["sender_key"].toString()
requestBody.sessionId = wireContent["session_id"].toString()
requestBody.algorithm = wireContent["algorithm"]?.toString()
requestBody.senderKey = wireContent["sender_key"]?.toString()
requestBody.sessionId = wireContent["session_id"]?.toString()
outgoingRoomKeyRequestManager.resendRoomKeyRequest(requestBody)
}

View File

@ -114,7 +114,7 @@ internal class MXOlmDevice @Inject constructor(
try {
deviceCurve25519Key = olmAccount!!.identityKeys()[OlmAccount.JSON_KEY_IDENTITY_KEY]
} catch (e: Exception) {
Timber.e(e, """## MXOlmDevice : cannot find ${OlmAccount.JSON_KEY_IDENTITY_KEY} with error""")
Timber.e(e, "## MXOlmDevice : cannot find ${OlmAccount.JSON_KEY_IDENTITY_KEY} with error")
}
try {

View File

@ -77,7 +77,6 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
MXCryptoError.UNABLE_TO_DECRYPT, MXCryptoError.MISSING_FIELDS_REASON))
}
val eventDecryptionResult: MXEventDecryptionResult?
var cryptoError: MXCryptoError? = null
var decryptGroupMessageResult: MXDecryptionResult? = null
@ -88,7 +87,7 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
}
// the decryption succeeds
if (decryptGroupMessageResult?.payload != null) {
eventDecryptionResult = MXEventDecryptionResult()
val eventDecryptionResult = MXEventDecryptionResult()
eventDecryptionResult.clearEvent = decryptGroupMessageResult.payload
eventDecryptionResult.senderCurve25519Key = decryptGroupMessageResult.senderKey
@ -215,11 +214,6 @@ internal class MXMegolmDecryption(private val credentials: Credentials,
forwardedRoomKeyContent.forwardingCurve25519KeyChain?.let {
forwardingCurve25519KeyChain.addAll(it)
}
// forwardingCurve25519KeyChain = if (forwardedRoomKeyContent.forwardingCurve25519KeyChain == null) {
// ArrayList()
// } else {
// ArrayList(forwardedRoomKeyContent.forwardingCurve25519KeyChain)
// }
if (senderKey == null) {
Timber.e("## onRoomKeyEvent() : event is missing sender_key field")