Don't mark message as read when the current window is not visible

Fix #378
This commit is contained in:
Carl Schwan
2021-05-31 17:21:03 +02:00
parent 6e5bca4928
commit 87d1fefae2

View File

@@ -260,7 +260,9 @@ Kirigami.ScrollablePage {
} }
onAtYEndChanged: if (atYEnd && hasScrolledUpBefore) { onAtYEndChanged: if (atYEnd && hasScrolledUpBefore) {
currentRoom.markAllMessagesAsRead(); if (QQC2.ApplicationWindow.window.visibility !== QQC2.ApplicationWindow.Hidden) {
currentRoom.markAllMessagesAsRead();
}
hasScrolledUpBefore = false; hasScrolledUpBefore = false;
} else if (!atYEnd) { } else if (!atYEnd) {
hasScrolledUpBefore = true; hasScrolledUpBefore = true;
@@ -573,7 +575,9 @@ Kirigami.ScrollablePage {
Timer { Timer {
id: makeMeDisapearTimer id: makeMeDisapearTimer
interval: Kirigami.Units.humanMoment * 2 interval: Kirigami.Units.humanMoment * 2
onTriggered: currentRoom.markAllMessagesAsRead(); onTriggered: if (QQC2.ApplicationWindow.window.visibility !== QQC2.ApplicationWindow.Hidden) {
currentRoom.markAllMessagesAsRead();
}
} }
ListView.onPooled: makeMeDisapearTimer.stop() ListView.onPooled: makeMeDisapearTimer.stop()
@@ -600,7 +604,9 @@ Kirigami.ScrollablePage {
if (view.atYEnd) { if (view.atYEnd) {
// easy case just mark everything as read // easy case just mark everything as read
currentRoom.markAllMessagesAsRead(); if (QQC2.ApplicationWindow.window.visibility !== QQC2.ApplicationWindow.Hidden) {
currentRoom.markAllMessagesAsRead();
}
return; return;
} }
@@ -616,11 +622,7 @@ Kirigami.ScrollablePage {
DelegateChoice { DelegateChoice {
roleValue: "other" roleValue: "other"
delegate: Rectangle { delegate: Item {}
height: 10
width: ListView.view.width
color: "red"
}
} }
} }