feat: add setting for notifications on requests

This commit is contained in:
Jonathan Rainville 2021-05-17 16:15:34 -04:00
parent ecf8b241f0
commit a90257e141
4 changed files with 7 additions and 8 deletions

View File

@ -184,9 +184,6 @@ ScrollView {
onMessageNotificationPushed: function(chatId, msg, messageType, chatType, timestamp, identicon, username, hasMention, isAddedContact, channelName) {
if (appSettings.notificationSetting == Constants.notifyAllMessages ||
(appSettings.notificationSetting == Constants.notifyJustMentions && hasMention)) {
if (chatType === Constants.chatTypeOneToOne && !appSettings.allowNotificationsFromNonContacts && !isAddedContact) {
return
}
if (chatId === chatsModel.activeChannel.id && applicationWindow.active === true) {
// Do not show the notif if we are in the channel already and the window is active and focused
return

View File

@ -122,6 +122,9 @@ Rectangle {
Connections {
target: profileModel.contacts
onContactRequestAdded: {
if (!appSettings.notifyOnNewRequests) {
return
}
systemTray.showMessage(qsTr("New contact request"),
qsTr("%1 requests to become contacts").arg(Utils.removeStatusEns(name)),
SystemTrayIcon.NoIcon,

View File

@ -253,12 +253,11 @@ ScrollView {
width: parent.width
StatusSettingsLineButton {
//% "Receive notifications from non-contacts"
text: qsTrId("receive-notifications-from-non-contacts")
text: qsTr("Notify on new requests")
isSwitch: true
switchChecked: appSettings.allowNotificationsFromNonContacts
switchChecked: appSettings.notifyOnNewRequests
onClicked: {
appSettings.allowNotificationsFromNonContacts = checked
appSettings.notifyOnNewRequests = checked
}
}

View File

@ -123,7 +123,7 @@ RowLayout {
property bool notificationSoundsEnabled: true
property bool useOSNotifications: true
property int notificationMessagePreviewSetting: Constants.notificationPreviewNameAndMessage
property bool allowNotificationsFromNonContacts: false
property bool notifyOnNewRequests: true
property var whitelistedUnfurlingSites: ({})
property bool neverAskAboutUnfurlingAgain: false
property bool hideChannelSuggestions: false