fix: remove notifications from OS tray when app is opened back
This commit is contained in:
parent
96c2f123b4
commit
82ede94700
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ ScrollView {
|
|||
message = qsTr("You have a new message")
|
||||
}
|
||||
|
||||
currentlyHasANotification = true
|
||||
if (appSettings.useOSNotifications && systemTray.supportsMessages) {
|
||||
systemTray.showMessage(name,
|
||||
message,
|
||||
|
|
11
ui/main.qml
11
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
|
||||
|
|
Loading…
Reference in New Issue