Better read market handling: Mark room as read when scrolling to the

bottom

Fix #372
This commit is contained in:
Carl Schwan
2021-05-27 20:55:19 +02:00
parent 8a55db4eb8
commit db0f421811

View File

@@ -23,13 +23,18 @@ Kirigami.ScrollablePage {
/// It's not readonly because of the seperate window view.
property var currentRoom: RoomManager.currentRoom
/// Used to determine if scrolling to the bottom should mark the message as unread
property bool hasScrolledUpBefore: false;
title: currentRoom.displayName
signal switchRoomUp()
signal switchRoomDown()
onCurrentRoomChanged: ChatBoxHelper.clearEditReply()
onCurrentRoomChanged: {
hasScrolledUpBefore = false;
ChatBoxHelper.clearEditReply()
}
ActionsHandler {
id: actionsHandler
@@ -254,6 +259,13 @@ Kirigami.ScrollablePage {
messageEventModel.fetchMore(messageEventModel.index(0, 0));
}
onAtYEndChanged: if (atYEnd && hasScrolledUpBefore) {
currentRoom.markAllMessagesAsRead();
hasScrolledUpBefore = false;
} else if (!atYEnd) {
hasScrolledUpBefore = true;
}
QQC2.Popup {
anchors.centerIn: parent