mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Timeline: clean listeners
This commit is contained in:
parent
141434e8f8
commit
f007fb04b8
1 changed files with 4 additions and 1 deletions
|
@ -43,7 +43,7 @@ import kotlin.collections.ArrayList
|
|||
import kotlin.collections.HashMap
|
||||
|
||||
|
||||
private const val INITIAL_LOAD_SIZE = 20
|
||||
private const val INITIAL_LOAD_SIZE = 10
|
||||
private const val MIN_FETCHING_COUNT = 30
|
||||
private const val DISPLAY_INDEX_UNKNOWN = Int.MIN_VALUE
|
||||
|
||||
|
@ -216,6 +216,7 @@ internal class DefaultTimeline(
|
|||
backgroundRealm.set(realm)
|
||||
clearUnlinkedEvents(realm)
|
||||
|
||||
|
||||
roomEntity = RoomEntity.where(realm, roomId = roomId).findFirst()?.also {
|
||||
it.sendingTimelineEvents.addChangeListener { _ ->
|
||||
postSnapshot()
|
||||
|
@ -242,6 +243,8 @@ internal class DefaultTimeline(
|
|||
Timber.v("Dispose timeline for roomId: $roomId and eventId: $initialEventId")
|
||||
BACKGROUND_HANDLER.post {
|
||||
cancelableBag.cancel()
|
||||
roomEntity?.sendingTimelineEvents?.removeAllChangeListeners()
|
||||
eventRelations.removeAllChangeListeners()
|
||||
liveEvents.removeAllChangeListeners()
|
||||
backgroundRealm.getAndSet(null).also {
|
||||
it.close()
|
||||
|
|
Loading…
Reference in a new issue