mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Realm: fix remaining frozen result
This commit is contained in:
parent
beeee7c84b
commit
f7c79a6de2
1 changed files with 8 additions and 1 deletions
|
@ -46,7 +46,7 @@ internal class RealmSendingEventsDataSource(
|
|||
|
||||
private val sendingTimelineEventsListener = RealmChangeListener<RealmList<TimelineEventEntity>> { events ->
|
||||
uiEchoManager.onSentEventsInDatabase(events.map { it.eventId })
|
||||
frozenSendingTimelineEvents = sendingTimelineEvents?.freeze()
|
||||
updateFrozenResults(events)
|
||||
onEventsUpdated(false)
|
||||
}
|
||||
|
||||
|
@ -59,10 +59,17 @@ internal class RealmSendingEventsDataSource(
|
|||
|
||||
override fun stop() {
|
||||
sendingTimelineEvents?.removeChangeListener(sendingTimelineEventsListener)
|
||||
updateFrozenResults(null)
|
||||
sendingTimelineEvents = null
|
||||
roomEntity = null
|
||||
}
|
||||
|
||||
private fun updateFrozenResults(sendingEvents: RealmList<TimelineEventEntity>?) {
|
||||
// Makes sure to close the previous frozen realm
|
||||
frozenSendingTimelineEvents?.realm?.close()
|
||||
frozenSendingTimelineEvents = sendingEvents?.freeze()
|
||||
}
|
||||
|
||||
override fun buildSendingEvents(): List<TimelineEvent> {
|
||||
val builtSendingEvents = mutableListOf<TimelineEvent>()
|
||||
uiEchoManager.getInMemorySendingEvents()
|
||||
|
|
Loading…
Reference in a new issue