2022-04-04 11:09:23 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
|
|
|
import "../controls"
|
2024-05-22 08:13:39 +00:00
|
|
|
import "../stores"
|
2022-04-04 11:09:23 +00:00
|
|
|
|
|
|
|
StatusModal {
|
|
|
|
id: root
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property NotificationsStore notificationsStore
|
2022-04-04 11:09:23 +00:00
|
|
|
property var item: ({
|
|
|
|
name: "",
|
|
|
|
image: "",
|
|
|
|
color: "",
|
|
|
|
customized: false,
|
|
|
|
type: Constants.settingsSection.exemptions.community,
|
|
|
|
muteAllMessages: false,
|
|
|
|
personalMentions: Constants.settingsSection.notifications.sendAlertsValue,
|
|
|
|
globalMentions: Constants.settingsSection.notifications.sendAlertsValue,
|
|
|
|
otherMessages: Constants.settingsSection.notifications.turnOffValue
|
|
|
|
})
|
2023-05-23 12:46:16 +00:00
|
|
|
headerSettings.title: qsTr("%1 exemption").arg(root.item.name)
|
|
|
|
headerSettings.asset: StatusAssetSettings {
|
2022-04-04 11:09:23 +00:00
|
|
|
// Once we introduce StatusSmartIdenticon in popup header, we should use the folowing
|
|
|
|
// color: root.item.type === Constants.settingsSection.exemptions.oneToOneChat?
|
|
|
|
// Theme.palette.userCustomizationColors[Utils.colorIdForPubkey(root.item.itemId)] :
|
|
|
|
// root.item.color
|
|
|
|
// until then the following is used
|
2022-10-13 11:08:43 +00:00
|
|
|
bgColor: d.isOneToOneChat ? Utils.colorForPubkey(root.item.itemId) : root.item.color
|
2022-08-11 11:55:08 +00:00
|
|
|
name: root.item.image
|
|
|
|
isImage: !!root.item.image
|
2022-10-13 11:08:43 +00:00
|
|
|
charactersLen: d.isOneToOneChat ? 2 : 1
|
2022-04-04 11:09:23 +00:00
|
|
|
isLetterIdenticon: root.item.image === ""
|
2022-10-13 11:08:43 +00:00
|
|
|
height: 40
|
|
|
|
width: 40
|
2022-04-04 11:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property bool isOneToOneChat: root.item.type === Constants.settingsSection.exemptions.oneToOneChat
|
|
|
|
readonly property int contentSpacing: 0
|
|
|
|
property bool muteAllMessages: root.item.muteAllMessages
|
|
|
|
property string personalMentions: root.item.personalMentions
|
|
|
|
property string globalMentions: root.item.globalMentions
|
|
|
|
property string otherMessages: root.item.otherMessages
|
|
|
|
property bool customized: d.muteAllMessages ||
|
|
|
|
d.personalMentions !== Constants.settingsSection.notifications.sendAlertsValue ||
|
|
|
|
d.globalMentions !== Constants.settingsSection.notifications.sendAlertsValue ||
|
|
|
|
d.otherMessages !== Constants.settingsSection.notifications.turnOffValue
|
|
|
|
}
|
|
|
|
|
|
|
|
contentItem: Column {
|
|
|
|
width: root.width
|
|
|
|
spacing: d.contentSpacing
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Mute all messages")
|
|
|
|
components: [
|
|
|
|
StatusSwitch {
|
|
|
|
id: muteAllMessagesSwitch
|
|
|
|
checked: d.muteAllMessages
|
|
|
|
onClicked: {
|
|
|
|
d.muteAllMessages = !d.muteAllMessages
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2022-08-24 14:37:05 +00:00
|
|
|
onClicked: {
|
2022-04-04 11:09:23 +00:00
|
|
|
muteAllMessagesSwitch.clicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
visible: !d.isOneToOneChat
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Personal @ Mentions")
|
|
|
|
visible: !d.isOneToOneChat
|
|
|
|
components: [
|
|
|
|
NotificationSelect {
|
|
|
|
selected: d.personalMentions
|
|
|
|
onSendAlertsClicked: d.personalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
|
|
|
onDeliverQuietlyClicked: d.personalMentions = Constants.settingsSection.notifications.deliverQuietlyValue
|
|
|
|
onTurnOffClicked: d.personalMentions = Constants.settingsSection.notifications.turnOffValue
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Global @ Mentions")
|
|
|
|
visible: !d.isOneToOneChat
|
|
|
|
components: [
|
|
|
|
NotificationSelect {
|
|
|
|
selected: d.globalMentions
|
|
|
|
onSendAlertsClicked: d.globalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
|
|
|
onDeliverQuietlyClicked: d.globalMentions = Constants.settingsSection.notifications.deliverQuietlyValue
|
|
|
|
onTurnOffClicked: d.globalMentions = Constants.settingsSection.notifications.turnOffValue
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
width: parent.width
|
|
|
|
title: qsTr("Other Messages")
|
|
|
|
visible: !d.isOneToOneChat
|
|
|
|
components: [
|
|
|
|
NotificationSelect {
|
|
|
|
selected: d.otherMessages
|
|
|
|
onSendAlertsClicked: d.otherMessages = Constants.settingsSection.notifications.sendAlertsValue
|
|
|
|
onDeliverQuietlyClicked: d.otherMessages = Constants.settingsSection.notifications.deliverQuietlyValue
|
|
|
|
onTurnOffClicked: d.otherMessages = Constants.settingsSection.notifications.turnOffValue
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rightButtons: [
|
|
|
|
StatusFlatButton {
|
|
|
|
text: qsTr("Clear Exemptions")
|
|
|
|
enabled: d.customized
|
|
|
|
onClicked: {
|
|
|
|
d.muteAllMessages = false
|
|
|
|
d.personalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
|
|
|
d.globalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
|
|
|
d.otherMessages = Constants.settingsSection.notifications.turnOffValue
|
|
|
|
}
|
|
|
|
},
|
|
|
|
StatusButton {
|
|
|
|
id: btnCreateEdit
|
|
|
|
text: qsTr("Done")
|
|
|
|
onClicked: {
|
|
|
|
root.notificationsStore.saveExemptions(root.item.itemId,
|
|
|
|
d.muteAllMessages,
|
|
|
|
d.personalMentions,
|
|
|
|
d.globalMentions,
|
|
|
|
d.otherMessages)
|
|
|
|
root.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|