Format code & add comments
This commit is contained in:
parent
a959a15636
commit
277619d833
@ -213,6 +213,7 @@ internal fun ThreadSummaryEntity.Companion.createOrUpdate(
|
||||
}
|
||||
}
|
||||
|
||||
// note: runBlocking should be used here while we are in realm single thread executor, to avoid thread switching
|
||||
private fun decryptIfNeeded(cryptoService: CryptoService?, eventEntity: EventEntity, roomId: String) = runBlocking {
|
||||
cryptoService ?: return@runBlocking
|
||||
val event = eventEntity.asDomain()
|
||||
|
@ -101,9 +101,7 @@ internal class TimelineEventDecryptor @Inject constructor(
|
||||
executor?.execute {
|
||||
Realm.getInstance(realmConfiguration).use { realm ->
|
||||
try {
|
||||
runBlocking {
|
||||
processDecryptRequest(request, realm)
|
||||
}
|
||||
} catch (e: InterruptedException) {
|
||||
Timber.i("Decryption got interrupted")
|
||||
}
|
||||
@ -122,7 +120,9 @@ internal class TimelineEventDecryptor @Inject constructor(
|
||||
threadsAwarenessHandler.makeEventThreadAware(realm, event.roomId, decryptedEvent, eventEntity)
|
||||
}
|
||||
}
|
||||
private suspend fun processDecryptRequest(request: DecryptionRequest, realm: Realm) {
|
||||
|
||||
// note: runBlocking should be used here while we are in realm single thread executor, to avoid thread switching
|
||||
private fun processDecryptRequest(request: DecryptionRequest, realm: Realm) = runBlocking {
|
||||
val event = request.event
|
||||
val timelineId = request.timelineId
|
||||
|
||||
@ -130,7 +130,7 @@ internal class TimelineEventDecryptor @Inject constructor(
|
||||
// Here we have requested a decryption to an event that is not encrypted
|
||||
// We will simply make this event thread aware
|
||||
threadAwareNonEncryptedEvents(request, realm)
|
||||
return
|
||||
return@runBlocking
|
||||
}
|
||||
try {
|
||||
val result = cryptoService.decryptEvent(request.event, timelineId)
|
||||
|
@ -506,6 +506,7 @@ internal class RoomSyncHandler @Inject constructor(private val readReceiptHandle
|
||||
}
|
||||
}
|
||||
|
||||
// note: runBlocking should be used here while we are in realm single thread executor, to avoid thread switching
|
||||
private fun decryptIfNeeded(event: Event, roomId: String) = runBlocking {
|
||||
try {
|
||||
// Event from sync does not have roomId, so add it to the event first
|
||||
|
Loading…
x
Reference in New Issue
Block a user