Improve room past events loading

- Trigger when room is shown if there's not enough messages to fill the
  list height

- Trigger whenever user is scrolling before a certain point, instead of
  when dragging is released/scrolling stopped and the top edge is hit

- Prevent multiple load requests at same time

- Keep a set of fully loaded rooms, don't request anymore history
  if a room is fully loaded
This commit is contained in:
miruka
2019-04-17 22:34:22 -04:00
parent a0f9acddaa
commit 6ab4acdc84
5 changed files with 39 additions and 9 deletions

View File

@@ -26,8 +26,14 @@ Rectangle {
// reloaded from network.
cacheBuffer: height * 6
onMovementEnded: if (atYBeginning) {
Backend.loadPastEvents(chatPage.room.room_id)
// Declaring this "alias" provides the on... signal
property real yPos: visibleArea.yPosition
onYPosChanged: {
console.log(yPos)
if (yPos <= 0.1) {
Backend.loadPastEvents(chatPage.room.room_id)
}
}
}
}