forked from GitHub-Mirror/riotX-android
wip crypto
This commit is contained in:
parent
94b4351e19
commit
7096094224
@ -35,7 +35,7 @@ data class TimelineEvent(
|
|||||||
val isUniqueDisplayName: Boolean,
|
val isUniqueDisplayName: Boolean,
|
||||||
val senderAvatar: String?,
|
val senderAvatar: String?,
|
||||||
val sendState: SendState,
|
val sendState: SendState,
|
||||||
// val hasClearEventFlag: Boolean = false,
|
val hasClearEventFlag: Boolean = false, //used to refresh
|
||||||
val annotations: EventAnnotationsSummary? = null
|
val annotations: EventAnnotationsSummary? = null
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@ -46,7 +46,8 @@ internal object TimelineEventMapper {
|
|||||||
senderName = timelineEventEntity.senderName,
|
senderName = timelineEventEntity.senderName,
|
||||||
isUniqueDisplayName = timelineEventEntity.isUniqueDisplayName,
|
isUniqueDisplayName = timelineEventEntity.isUniqueDisplayName,
|
||||||
senderAvatar = timelineEventEntity.senderAvatar,
|
senderAvatar = timelineEventEntity.senderAvatar,
|
||||||
sendState = timelineEventEntity.root?.sendState ?: SendState.UNKNOWN
|
sendState = timelineEventEntity.root?.sendState ?: SendState.UNKNOWN,
|
||||||
|
hasClearEventFlag = timelineEventEntity.root?.decryptionResultJson != null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,5 +81,7 @@ internal open class EventEntity(@PrimaryKey var localId: String = UUID.randomUUI
|
|||||||
)
|
)
|
||||||
val adapter = MoshiProvider.providesMoshi().adapter<OlmDecryptionResult>(OlmDecryptionResult::class.java)
|
val adapter = MoshiProvider.providesMoshi().adapter<OlmDecryptionResult>(OlmDecryptionResult::class.java)
|
||||||
decryptionResultJson = adapter.toJson(decryptionResult)
|
decryptionResultJson = adapter.toJson(decryptionResult)
|
||||||
|
decryptionErrorCode = null
|
||||||
|
timelineEventEntity?.firstOrNull()?.root = this
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -99,14 +99,10 @@ internal class TimelineEventDecryptor(
|
|||||||
val event = eventEntity.asDomain()
|
val event = eventEntity.asDomain()
|
||||||
try {
|
try {
|
||||||
val result = cryptoService.decryptEvent(event, timelineId)
|
val result = cryptoService.decryptEvent(event, timelineId)
|
||||||
if (result == null) {
|
Timber.v("Successfully decrypted event ${eventId}")
|
||||||
Timber.e("Null decryption result for event ${eventId}")
|
eventEntity.setDecryptionResult(result)
|
||||||
} else {
|
|
||||||
Timber.v("Successfully decrypted event ${eventId}")
|
|
||||||
eventEntity.setDecryptionResult(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e: MXCryptoError) {
|
} catch (e: MXCryptoError) {
|
||||||
|
Timber.v("Failed to decrypte event ${eventId} ${e}")
|
||||||
if (e is MXCryptoError.Base && e.errorType == MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID) {
|
if (e is MXCryptoError.Base && e.errorType == MXCryptoError.ErrorType.UNKNOWN_INBOUND_SESSION_ID) {
|
||||||
//Keep track of unknown sessions to automatically try to decrypt on new session
|
//Keep track of unknown sessions to automatically try to decrypt on new session
|
||||||
eventEntity.decryptionErrorCode = e.errorType.name
|
eventEntity.decryptionErrorCode = e.errorType.name
|
||||||
|
Loading…
Reference in New Issue
Block a user