This commit is contained in:
Benoit Marty 2021-03-12 12:16:25 +01:00 committed by Benoit Marty
parent 0b0634b531
commit 857bfcb971
3 changed files with 4 additions and 6 deletions

View file

@ -5,7 +5,7 @@ Features ✨:
- -
Improvements 🙌: Improvements 🙌:
- - Lazy storage of ReadReceipts
Bugfix 🐛: Bugfix 🐛:
- -

View file

@ -121,13 +121,11 @@ internal class ReadReceiptHandler @Inject constructor(
} }
fun getContentFromInitSync(roomId: String): ReadReceiptContent? { fun getContentFromInitSync(roomId: String): ReadReceiptContent? {
@Suppress("UNCHECKED_CAST")
return roomSyncEphemeralTemporaryStore.read(roomId) return roomSyncEphemeralTemporaryStore.read(roomId)
?.also { roomSyncEphemeralTemporaryStore.delete(roomId) } ?.also { roomSyncEphemeralTemporaryStore.delete(roomId) }
?.events ?.events
?.firstOrNull { it.type == EventType.RECEIPT } ?.firstOrNull { it.type == EventType.RECEIPT }
?.let { ?.content as? ReadReceiptContent
@Suppress("UNCHECKED_CAST")
it.content as? ReadReceiptContent
}
} }
} }

View file

@ -35,7 +35,7 @@ internal interface RoomSyncEphemeralTemporaryStore {
} }
internal class RoomSyncEphemeralTemporaryStoreFile @Inject constructor( internal class RoomSyncEphemeralTemporaryStoreFile @Inject constructor(
@SessionFilesDirectory private val fileDirectory: File @SessionFilesDirectory fileDirectory: File
) : RoomSyncEphemeralTemporaryStore { ) : RoomSyncEphemeralTemporaryStore {
private val workingDir = File(fileDirectory, "rr") private val workingDir = File(fileDirectory, "rr")