Fix marking messages as read when the window is thin

Make sure that messages are not marked as read when going back to the roomlist after entering a room when neochat is thin and only showing a single page

Fixes #642
This commit is contained in:
James Graham
2024-03-30 19:32:19 +00:00
parent 276dcce95e
commit 482d61ee47
2 changed files with 5 additions and 2 deletions

View File

@@ -120,6 +120,7 @@ Kirigami.Page {
sourceComponent: TimelineView { sourceComponent: TimelineView {
id: timelineView id: timelineView
currentRoom: root.currentRoom currentRoom: root.currentRoom
page: root
timelineModel: root.timelineModel timelineModel: root.timelineModel
messageFilterModel: root.messageFilterModel messageFilterModel: root.messageFilterModel
actionsHandler: root.actionsHandler actionsHandler: root.actionsHandler

View File

@@ -27,6 +27,8 @@ QQC2.ScrollView {
} }
property bool roomChanging: false property bool roomChanging: false
required property Item page
/** /**
* @brief The TimelineModel to use. * @brief The TimelineModel to use.
* *
@@ -299,14 +301,14 @@ QQC2.ScrollView {
Timer { Timer {
id: markReadIfVisibleTimer id: markReadIfVisibleTimer
running: messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) running: messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) && applicationWindow().pageStack.visibleItems.includes(root.page)
interval: 10000 interval: 10000
onTriggered: root.currentRoom.markAllMessagesAsRead() onTriggered: root.currentRoom.markAllMessagesAsRead()
function reset() { function reset() {
restart(); restart();
running = Qt.binding(function () { running = Qt.binding(function () {
return messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded); return messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) && applicationWindow().pageStack.visibleItems.includes(root.page);
}); });
} }
} }