Fix / clear unknown session map before re-request decrypt

This commit is contained in:
Valere 2019-07-08 12:49:22 +02:00
parent 7096094224
commit ee27d3e047
2 changed files with 8 additions and 3 deletions

View file

@ -38,12 +38,16 @@ internal class TimelineEventDecryptor(
private val newSessionListener = object : NewSessionListener {
override fun onNewSession(roomId: String?, senderKey: String, sessionId: String) {
synchronized(unknownSessionsFailure) {
val toDecryptAgain = ArrayList<String>()
unknownSessionsFailure[sessionId]?.let { eventIds ->
eventIds.forEach {
toDecryptAgain.addAll(eventIds)
}
if (toDecryptAgain.isNotEmpty()) {
unknownSessionsFailure[sessionId]?.clear()
toDecryptAgain.forEach {
requestDecryption(it)
}
}
unknownSessionsFailure[sessionId]?.clear()
}
}

View file

@ -55,7 +55,8 @@ class EncryptedItemFactory @Inject constructor(private val messageInformationDat
cryptoError?.name
}
val message = stringProvider.getString(R.string.notice_crypto_unable_to_decrypt, errorDescription)
val message = stringProvider.getString(R.string.encrypted_message).takeIf { cryptoError == null }
?: stringProvider.getString(R.string.notice_crypto_unable_to_decrypt, errorDescription)
val spannableStr = span(message) {
textStyle = "italic"
textColor = colorProvider.getColorFromAttribute(R.attr.riotx_text_secondary)