Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Jan 21, 2022
1 parent fecd2cd commit 724a39d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,23 @@ class CryptoInfoController @Inject constructor(

val senderInfo = when {
successInfo.sentByThisDevice -> {
host.stringProvider.getString(R.string.encryption_information_sent_by_you_from_device, successInfo.sentByUser.deviceId)
host.stringProvider.getString(
R.string.encryption_information_sent_by_you_from_device,
successInfo.sentByUser.deviceId
)
}
successInfo.sentByMe -> {
host.stringProvider.getString(R.string.encryption_information_sent_by_you_from_other_device, successInfo.sentByUser.deviceId)
host.stringProvider.getString(
R.string.encryption_information_sent_by_you_from_other_device,
successInfo.sentByUser.deviceId
)
}
else -> {
host.stringProvider.getString(R.string.encryption_information_sent_by_other_from_device, successInfo.sentByUser.userId, successInfo.sentByUser.deviceId)
host.stringProvider.getString(
R.string.encryption_information_sent_by_other_from_device,
successInfo.sentByUser.userId,
successInfo.sentByUser.deviceId
)
}
}
// Sender info
Expand Down Expand Up @@ -184,7 +194,7 @@ class CryptoInfoController @Inject constructor(
title(userId.toEpoxyCharSequence())
description(
span {
+deviceInfos.map { it.deviceId }.joinToString(", ")
+deviceInfos.joinToString(", ") { it.deviceId }
}.toEpoxyCharSequence()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,10 @@ class CryptoInfoViewModel @AssistedInject constructor(
val messageIndex = encryptedContent.ciphertext?.fromBase64()?.inputStream()?.reader()?.let {
tryOrNull {
val megolmVersion = it.read()
if (megolmVersion == 3) {
if (it.read() == 8
/** Int tag */
) {
return@let it.read()
}
}
return@let null
if (megolmVersion != 3) return@tryOrNull null
/** Int tag */
if (it.read() != 8) return@tryOrNull null
it.read()
}
}

Expand All @@ -112,7 +108,12 @@ class CryptoInfoViewModel @AssistedInject constructor(
} else {
emptyList()
}
val locallyKnownIndex = session.cryptoService().isMegolmSessionKnownLocally(initialState.roomId, encryptedContent.sessionId, encryptedContent.senderKey)
val locallyKnownIndex = session.cryptoService()
.isMegolmSessionKnownLocally(
initialState.roomId,
encryptedContent.sessionId,
encryptedContent.senderKey
)

tickerFlow(viewModelScope, 5_000, 0)
.execute {
Expand Down Expand Up @@ -157,7 +158,7 @@ class CryptoInfoViewModel @AssistedInject constructor(
try {
session.cryptoService().replyToForwardKeyRequest(action.request)
} catch (failure: Throwable) {
Timber.w("## VALR: failed to share $failure")
Timber.w("## failed to share $failure")
}
}
}
Expand Down

0 comments on commit 724a39d

Please sign in to comment.