Timeline: update when loading states changed

This commit is contained in:
ganfra 2021-12-02 20:42:29 +01:00
parent 3d31ba963d
commit 03961fe933
2 changed files with 9 additions and 1 deletions

View file

@ -95,7 +95,7 @@ interface Timeline {
*/
fun onNewTimelineEvents(eventIds: List<String>)
fun onStateUpdated() = Unit
fun onStateUpdated(direction: Direction, state: PaginationState) = Unit
}
/**

View file

@ -309,6 +309,14 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
// no-op, already handled
}
override fun onStateUpdated(direction: Timeline.Direction, state: Timeline.PaginationState) {
if(!state.hasMoreToLoad) {
backgroundHandler.post {
requestModelBuild()
}
}
}
private fun submitSnapshot(newSnapshot: List<TimelineEvent>) {
backgroundHandler.post {
inSubmitList = true