diff --git a/ui/app/AppLayouts/Chat/ChatColumn.qml b/ui/app/AppLayouts/Chat/ChatColumn.qml index c9a448e573..5e9308b586 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn.qml @@ -42,7 +42,7 @@ StackLayout { currentIndex: chatsModel.activeChannelIndex > -1 && chatGroupsListViewCount > 0 ? 0 : 1 - property var idMap: {} + property var idMap: ({}) function addSuggestionFromMessageList(i){ const contactAddr = chatsModel.messageList.getMessageData(i, "publicKey"); @@ -76,8 +76,8 @@ StackLayout { idMap[contactAddr] = true; } const len2 = chatsModel.messageList.rowCount(); - for (let i = 0; i < len2; i++) { - addSuggestionFromMessageList(i); + for (let f = 0; f < len2; f++) { + addSuggestionFromMessageList(f); } } diff --git a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml index 6a06619a14..793b670d55 100644 --- a/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml +++ b/ui/app/AppLayouts/Chat/ChatColumn/ChatMessages.qml @@ -191,6 +191,7 @@ ScrollView { message = qsTr("You have a new message") } + currentlyHasANotification = true if (appSettings.useOSNotifications && systemTray.supportsMessages) { systemTray.showMessage(name, message, diff --git a/ui/main.qml b/ui/main.qml index 1c2f1d3700..7a0c4cd05b 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -230,6 +230,17 @@ ApplicationWindow { } } + property bool currentlyHasANotification: false + + onActiveChanged: { + if (active && currentlyHasANotification) { + currentlyHasANotification = false + // QML doesn't have a function to hide notifications, but this does the trick + systemTray.hide() + systemTray.show() + } + } + SystemTrayIcon { id: systemTray visible: true