fix(@desktop/notifications): move notifications settings to `status-go`
Fixes #5649
This commit is contained in:
parent
72c389ba09
commit
aeba272ae4
|
@ -47,6 +47,7 @@ type
|
||||||
notificationsManager*: NotificationsManager
|
notificationsManager*: NotificationsManager
|
||||||
|
|
||||||
# Global
|
# Global
|
||||||
|
appSettingsVariant: QVariant
|
||||||
localAppSettingsVariant: QVariant
|
localAppSettingsVariant: QVariant
|
||||||
localAccountSettingsVariant: QVariant
|
localAccountSettingsVariant: QVariant
|
||||||
localAccountSensitiveSettingsVariant: QVariant
|
localAccountSensitiveSettingsVariant: QVariant
|
||||||
|
@ -111,18 +112,21 @@ proc connect(self: AppController) =
|
||||||
proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
proc newAppController*(statusFoundation: StatusFoundation): AppController =
|
||||||
result = AppController()
|
result = AppController()
|
||||||
result.statusFoundation = statusFoundation
|
result.statusFoundation = statusFoundation
|
||||||
result.notificationsManager = newNotificationsManager(statusFoundation.events)
|
|
||||||
|
# Preparing settings service to be exposed later as global QObject
|
||||||
|
result.settingsService = settings_service.newService()
|
||||||
|
result.appSettingsVariant = newQVariant(result.settingsService)
|
||||||
|
result.notificationsManager = newNotificationsManager(statusFoundation.events, result.settingsService)
|
||||||
|
|
||||||
# Global
|
# Global
|
||||||
result.localAppSettingsVariant = newQVariant(singletonInstance.localAppSettings)
|
result.localAppSettingsVariant = newQVariant(singletonInstance.localAppSettings)
|
||||||
result.localAccountSettingsVariant = newQVariant(singletonInstance.localAccountSettings)
|
result.localAccountSettingsVariant = newQVariant(singletonInstance.localAccountSettings)
|
||||||
result.localAccountSensitiveSettingsVariant = newQVariant(singletonInstance.localAccountSensitiveSettings)
|
result.localAccountSensitiveSettingsVariant = newQVariant(singletonInstance.localAccountSensitiveSettings)
|
||||||
result.userProfileVariant = newQVariant(singletonInstance.userProfile)
|
result.userProfileVariant = newQVariant(singletonInstance.userProfile)
|
||||||
result.globalUtilsVariant = newQVariant(singletonInstance.utils)
|
result.globalUtilsVariant = newQVariant(singletonInstance.utils)
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
result.generalService = general_service.newService()
|
result.generalService = general_service.newService()
|
||||||
result.settingsService = settings_service.newService()
|
|
||||||
result.nodeConfigurationService = node_configuration_service.newService(statusFoundation.fleetConfiguration,
|
result.nodeConfigurationService = node_configuration_service.newService(statusFoundation.fleetConfiguration,
|
||||||
result.settingsService)
|
result.settingsService)
|
||||||
result.keychainService = keychain_service.newService(statusFoundation.events)
|
result.keychainService = keychain_service.newService(statusFoundation.events)
|
||||||
|
@ -237,6 +241,7 @@ proc delete*(self: AppController) =
|
||||||
self.mainModule.delete
|
self.mainModule.delete
|
||||||
self.languageService.delete
|
self.languageService.delete
|
||||||
|
|
||||||
|
self.appSettingsVariant.delete
|
||||||
self.localAppSettingsVariant.delete
|
self.localAppSettingsVariant.delete
|
||||||
self.localAccountSettingsVariant.delete
|
self.localAccountSettingsVariant.delete
|
||||||
self.localAccountSensitiveSettingsVariant.delete
|
self.localAccountSensitiveSettingsVariant.delete
|
||||||
|
@ -314,12 +319,10 @@ proc load(self: AppController) =
|
||||||
self.ensService.init()
|
self.ensService.init()
|
||||||
self.gifService.init()
|
self.gifService.init()
|
||||||
|
|
||||||
|
# Accessible after user login
|
||||||
|
singletonInstance.engine.setRootContextProperty("appSettings", self.appSettingsVariant)
|
||||||
singletonInstance.engine.setRootContextProperty("globalUtils", self.globalUtilsVariant)
|
singletonInstance.engine.setRootContextProperty("globalUtils", self.globalUtilsVariant)
|
||||||
|
|
||||||
let pubKey = self.settingsService.getPublicKey()
|
|
||||||
singletonInstance.localAccountSensitiveSettings.setFileName(pubKey)
|
|
||||||
singletonInstance.engine.setRootContextProperty("localAccountSensitiveSettings", self.localAccountSensitiveSettingsVariant)
|
|
||||||
|
|
||||||
self.buildAndRegisterLocalAccountSensitiveSettings()
|
self.buildAndRegisterLocalAccountSensitiveSettings()
|
||||||
self.buildAndRegisterUserProfile()
|
self.buildAndRegisterUserProfile()
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import NimQml, json, chronicles
|
||||||
import ../../global/app_signals
|
import ../../global/app_signals
|
||||||
import ../../global/global_singleton
|
import ../../global/global_singleton
|
||||||
import ../eventemitter
|
import ../eventemitter
|
||||||
|
import ../../../app_service/service/settings/service as settings_service
|
||||||
import details
|
import details
|
||||||
|
|
||||||
export details
|
export details
|
||||||
|
@ -39,15 +40,17 @@ type
|
||||||
QtObject:
|
QtObject:
|
||||||
type NotificationsManager* = ref object of QObject
|
type NotificationsManager* = ref object of QObject
|
||||||
events: EventEmitter
|
events: EventEmitter
|
||||||
|
settingsService: settings_service.Service
|
||||||
osNotification: StatusOSNotification
|
osNotification: StatusOSNotification
|
||||||
soundManager: StatusSoundManager
|
soundManager: StatusSoundManager
|
||||||
notificationSetUp: bool
|
notificationSetUp: bool
|
||||||
|
|
||||||
proc processNotification(self: NotificationsManager, title: string, message: string, details: NotificationDetails)
|
proc processNotification(self: NotificationsManager, title: string, message: string, details: NotificationDetails)
|
||||||
|
|
||||||
proc setup(self: NotificationsManager, events: EventEmitter) =
|
proc setup(self: NotificationsManager, events: EventEmitter, settingsService: settings_service.Service) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
self.events = events
|
self.events = events
|
||||||
|
self.settingsService = settingsService
|
||||||
|
|
||||||
proc delete*(self: NotificationsManager) =
|
proc delete*(self: NotificationsManager) =
|
||||||
if self.notificationSetUp:
|
if self.notificationSetUp:
|
||||||
|
@ -55,9 +58,9 @@ QtObject:
|
||||||
self.soundManager.delete
|
self.soundManager.delete
|
||||||
self.QObject.delete
|
self.QObject.delete
|
||||||
|
|
||||||
proc newNotificationsManager*(events: EventEmitter): NotificationsManager =
|
proc newNotificationsManager*(events: EventEmitter, settingsService: settings_service.Service): NotificationsManager =
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
result.setup(events)
|
result.setup(events, settingsService)
|
||||||
|
|
||||||
proc init*(self: NotificationsManager) =
|
proc init*(self: NotificationsManager) =
|
||||||
self.osNotification = newStatusOSNotification()
|
self.osNotification = newStatusOSNotification()
|
||||||
|
@ -145,27 +148,6 @@ QtObject:
|
||||||
sectionId: sectionId)
|
sectionId: sectionId)
|
||||||
self.processNotification(title, message, details)
|
self.processNotification(title, message, details)
|
||||||
|
|
||||||
proc getExemptions(self: NotificationsManager, id: string): JsonNode =
|
|
||||||
# This proc returns exemptions as json object for the passed `id` if there are no set exemptions,
|
|
||||||
# json object with the default values will be returned.
|
|
||||||
let allExemptions = singletonInstance.localAccountSensitiveSettings.getNotifSettingExemptionsAsJson()
|
|
||||||
result = %* {
|
|
||||||
EXEMPTION_KEY_MUTE_ALL_MESSAGES: false,
|
|
||||||
EXEMPTION_KEY_PERSONAL_MENTIONS: LSS_VALUE_NOTIF_SEND_ALERTS,
|
|
||||||
EXEMPTION_KEY_GLOBAL_MENTIONS: LSS_VALUE_NOTIF_SEND_ALERTS,
|
|
||||||
EXEMPTION_KEY_OTHER_MESSAGES: LSS_VALUE_NOTIF_SEND_TURN_OFF
|
|
||||||
}
|
|
||||||
if(allExemptions.contains(id)):
|
|
||||||
let obj = allExemptions[id]
|
|
||||||
if(obj.contains(EXEMPTION_KEY_MUTE_ALL_MESSAGES)):
|
|
||||||
result[EXEMPTION_KEY_MUTE_ALL_MESSAGES] = obj[EXEMPTION_KEY_MUTE_ALL_MESSAGES]
|
|
||||||
if(obj.contains(EXEMPTION_KEY_PERSONAL_MENTIONS)):
|
|
||||||
result[EXEMPTION_KEY_PERSONAL_MENTIONS] = obj[EXEMPTION_KEY_PERSONAL_MENTIONS]
|
|
||||||
if(obj.contains(EXEMPTION_KEY_GLOBAL_MENTIONS)):
|
|
||||||
result[EXEMPTION_KEY_GLOBAL_MENTIONS] = obj[EXEMPTION_KEY_GLOBAL_MENTIONS]
|
|
||||||
if(obj.contains(EXEMPTION_KEY_OTHER_MESSAGES)):
|
|
||||||
result[EXEMPTION_KEY_OTHER_MESSAGES] = obj[EXEMPTION_KEY_OTHER_MESSAGES]
|
|
||||||
|
|
||||||
proc notificationCheck(self: NotificationsManager, title: string, message: string, details: NotificationDetails,
|
proc notificationCheck(self: NotificationsManager, title: string, message: string, details: NotificationDetails,
|
||||||
notificationWay: string) =
|
notificationWay: string) =
|
||||||
var data = NotificationArgs(title: title, message: message, details: details)
|
var data = NotificationArgs(title: title, message: message, details: details)
|
||||||
|
@ -183,7 +165,7 @@ QtObject:
|
||||||
details.notificationType == NotificationType.NewContactRequest or
|
details.notificationType == NotificationType.NewContactRequest or
|
||||||
details.notificationType == NotificationType.IdentityVerificationRequest):
|
details.notificationType == NotificationType.IdentityVerificationRequest):
|
||||||
|
|
||||||
if(notificationWay == LSS_VALUE_NOTIF_SEND_DELIVER_QUIETLY):
|
if(notificationWay == VALUE_NOTIF_DELIVER_QUIETLY):
|
||||||
return
|
return
|
||||||
|
|
||||||
if((details.notificationType == NotificationType.NewMessage or
|
if((details.notificationType == NotificationType.NewMessage or
|
||||||
|
@ -200,17 +182,17 @@ QtObject:
|
||||||
|
|
||||||
if(not appIsActive or details.notificationType == NotificationType.TestNotification):
|
if(not appIsActive or details.notificationType == NotificationType.TestNotification):
|
||||||
# Check anonymity level
|
# Check anonymity level
|
||||||
if(singletonInstance.localAccountSensitiveSettings.getNotificationMessagePreviewSetting() == PREVIEW_ANONYMOUS):
|
if(self.settingsService.getNotificationMessagePreview() == PREVIEW_ANONYMOUS):
|
||||||
data.title = "Status"
|
data.title = "Status"
|
||||||
data.message = "You have a new message"
|
data.message = "You have a new message"
|
||||||
elif(singletonInstance.localAccountSensitiveSettings.getNotificationMessagePreviewSetting() == PREVIEW_NAME_ONLY):
|
elif(self.settingsService.getNotificationMessagePreview() == PREVIEW_NAME_ONLY):
|
||||||
data.message = "You have a new message"
|
data.message = "You have a new message"
|
||||||
let identifier = $(details.toJsonNode())
|
let identifier = $(details.toJsonNode())
|
||||||
debug "Add OS notification", title=data.title, message=data.message, identifier=identifier
|
debug "Add OS notification", title=data.title, message=data.message, identifier=identifier
|
||||||
self.showOSNotification(data.title, data.message, identifier)
|
self.showOSNotification(data.title, data.message, identifier)
|
||||||
|
|
||||||
if(singletonInstance.localAccountSensitiveSettings.getNotificationSoundsEnabled()):
|
if(self.settingsService.getNotificationSoundsEnabled()):
|
||||||
self.soundManager.setPlayerVolume(singletonInstance.localAccountSensitiveSettings.getVolume())
|
self.soundManager.setPlayerVolume(self.settingsService.getNotificationVolume())
|
||||||
self.soundManager.playSound(NOTIFICATION_SOUND)
|
self.soundManager.playSound(NOTIFICATION_SOUND)
|
||||||
|
|
||||||
proc processNotification(self: NotificationsManager, title: string, message: string, details: NotificationDetails) =
|
proc processNotification(self: NotificationsManager, title: string, message: string, details: NotificationDetails) =
|
||||||
|
@ -225,76 +207,76 @@ QtObject:
|
||||||
# - https://drive.google.com/file/d/1L_9c2CMObcDcSuhVUu97s9-_26gtutES/view
|
# - https://drive.google.com/file/d/1L_9c2CMObcDcSuhVUu97s9-_26gtutES/view
|
||||||
# - https://drive.google.com/file/d/1KmG7lJDJIx6R_HJWeFvMYT2wk32RoTJQ/view
|
# - https://drive.google.com/file/d/1KmG7lJDJIx6R_HJWeFvMYT2wk32RoTJQ/view
|
||||||
|
|
||||||
if(not singletonInstance.localAccountSensitiveSettings.getNotifSettingAllowNotifications()):
|
if(not self.settingsService.getNotifSettingAllowNotifications()):
|
||||||
return
|
return
|
||||||
|
|
||||||
# In case of contact request
|
# In case of contact request
|
||||||
if(details.notificationType == NotificationType.NewContactRequest):
|
if(details.notificationType == NotificationType.NewContactRequest):
|
||||||
if(singletonInstance.localAccountSensitiveSettings.getNotifSettingContactRequests() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
if(self.settingsService.getNotifSettingContactRequests() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingContactRequests())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingContactRequests())
|
||||||
return
|
return
|
||||||
|
|
||||||
# In case of identity verification request
|
# In case of identity verification request
|
||||||
elif(details.notificationType == NotificationType.IdentityVerificationRequest):
|
elif(details.notificationType == NotificationType.IdentityVerificationRequest):
|
||||||
if(singletonInstance.localAccountSensitiveSettings.getNotifSettingIdentityVerificationRequests() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
if(self.settingsService.getNotifSettingIdentityVerificationRequests() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingIdentityVerificationRequests())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingIdentityVerificationRequests())
|
||||||
return
|
return
|
||||||
|
|
||||||
# In case of new message (regardless it's message with mention or not)
|
# In case of new message (regardless it's message with mention or not)
|
||||||
elif(details.notificationType == NotificationType.NewMessage or
|
elif(details.notificationType == NotificationType.NewMessage or
|
||||||
details.notificationType == NotificationType.NewMessageWithPersonalMention or
|
details.notificationType == NotificationType.NewMessageWithPersonalMention or
|
||||||
details.notificationType == NotificationType.NewMessageWithGlobalMention):
|
details.notificationType == NotificationType.NewMessageWithGlobalMention):
|
||||||
if(singletonInstance.localAccountSensitiveSettings.getNotifSettingAllMessages() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
if(self.settingsService.getNotifSettingAllMessages() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingAllMessages())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingAllMessages())
|
||||||
return
|
return
|
||||||
|
|
||||||
let messageBelongsToCommunity = details.isCommunitySection
|
let messageBelongsToCommunity = details.isCommunitySection
|
||||||
if(messageBelongsToCommunity):
|
if(messageBelongsToCommunity):
|
||||||
let exemptionObj = self.getExemptions(details.sectionId)
|
let exemptions = self.settingsService.getNotifSettingExemptions(details.sectionId)
|
||||||
if(exemptionObj[EXEMPTION_KEY_MUTE_ALL_MESSAGES].getBool):
|
if(exemptions.muteAllMessages):
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.notificationType == NotificationType.NewMessageWithPersonalMention and
|
if(details.notificationType == NotificationType.NewMessageWithPersonalMention and
|
||||||
exemptionObj[EXEMPTION_KEY_PERSONAL_MENTIONS].getStr != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
exemptions.personalMentions != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, exemptionObj[EXEMPTION_KEY_PERSONAL_MENTIONS].getStr)
|
self.notificationCheck(title, message, details, exemptions.personalMentions)
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.notificationType == NotificationType.NewMessageWithGlobalMention and
|
if(details.notificationType == NotificationType.NewMessageWithGlobalMention and
|
||||||
exemptionObj[EXEMPTION_KEY_GLOBAL_MENTIONS].getStr != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
exemptions.globalMentions != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, exemptionObj[EXEMPTION_KEY_GLOBAL_MENTIONS].getStr)
|
self.notificationCheck(title, message, details, exemptions.globalMentions)
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.notificationType == NotificationType.NewMessage and
|
if(details.notificationType == NotificationType.NewMessage and
|
||||||
exemptionObj[EXEMPTION_KEY_OTHER_MESSAGES].getStr != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
exemptions.otherMessages != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, exemptionObj[EXEMPTION_KEY_OTHER_MESSAGES].getStr)
|
self.notificationCheck(title, message, details, exemptions.otherMessages)
|
||||||
return
|
return
|
||||||
|
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if(details.isOneToOne or details.isGroupChat):
|
if(details.isOneToOne or details.isGroupChat):
|
||||||
let exemptionObj = self.getExemptions(details.chatId)
|
let exemptions = self.settingsService.getNotifSettingExemptions(details.chatId)
|
||||||
if(exemptionObj[EXEMPTION_KEY_MUTE_ALL_MESSAGES].getBool):
|
if(exemptions.muteAllMessages):
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.notificationType == NotificationType.NewMessageWithPersonalMention and
|
if(details.notificationType == NotificationType.NewMessageWithPersonalMention and
|
||||||
singletonInstance.localAccountSensitiveSettings.getNotifSettingPersonalMentions() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
self.settingsService.getNotifSettingPersonalMentions() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingPersonalMentions())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingPersonalMentions())
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.notificationType == NotificationType.NewMessageWithGlobalMention and
|
if(details.notificationType == NotificationType.NewMessageWithGlobalMention and
|
||||||
singletonInstance.localAccountSensitiveSettings.getNotifSettingGlobalMentions() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
self.settingsService.getNotifSettingGlobalMentions() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingGlobalMentions())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingGlobalMentions())
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.notificationType == NotificationType.NewMessage):
|
if(details.notificationType == NotificationType.NewMessage):
|
||||||
if(details.isOneToOne and
|
if(details.isOneToOne and
|
||||||
singletonInstance.localAccountSensitiveSettings.getNotifSettingOneToOneChats() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
self.settingsService.getNotifSettingOneToOneChats() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingOneToOneChats())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingOneToOneChats())
|
||||||
return
|
return
|
||||||
|
|
||||||
if(details.isGroupChat and
|
if(details.isGroupChat and
|
||||||
singletonInstance.localAccountSensitiveSettings.getNotifSettingGroupChats() != LSS_VALUE_NOTIF_SEND_TURN_OFF):
|
self.settingsService.getNotifSettingGroupChats() != VALUE_NOTIF_TURN_OFF):
|
||||||
self.notificationCheck(title, message, details, singletonInstance.localAccountSensitiveSettings.getNotifSettingGroupChats())
|
self.notificationCheck(title, message, details, self.settingsService.getNotifSettingGroupChats())
|
||||||
return
|
return
|
||||||
|
|
||||||
# In all other cases (TestNotification, AcceptedContactRequest, JoinCommunityRequest, MyRequestToJoinCommunityAccepted,
|
# In all other cases (TestNotification, AcceptedContactRequest, JoinCommunityRequest, MyRequestToJoinCommunityAccepted,
|
||||||
|
|
|
@ -36,12 +36,6 @@ const LSS_KEY_HIDDEN_COMMUNITY_CHANNELS_AND_CATEGORIES_BANNERS* = "hiddenCommuni
|
||||||
const DEFAULT_HIDDEN_COMMUNITY_CHANNELS_AND_CATEGORIES_BANNERS = ""
|
const DEFAULT_HIDDEN_COMMUNITY_CHANNELS_AND_CATEGORIES_BANNERS = ""
|
||||||
const LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS* = "hiddenCommunityBackUpBanners"
|
const LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS* = "hiddenCommunityBackUpBanners"
|
||||||
const DEFAULT_HIDDEN_COMMUNITY_BACKUP_BANNERS = ""
|
const DEFAULT_HIDDEN_COMMUNITY_BACKUP_BANNERS = ""
|
||||||
const LSS_KEY_VOLUME* = "volume"
|
|
||||||
const DEFAULT_VOLUME = 50
|
|
||||||
const LSS_KEY_NOTIFICATION_SOUNDS_ENABLED* = "notificationSoundsEnabled"
|
|
||||||
const DEFAULT_NOTIFICATION_SOUNDS_ENABLED = true
|
|
||||||
const LSS_KEY_NOTIFICATION_MESSAGE_PREVIEW_SETTING* = "notificationMessagePreviewSetting"
|
|
||||||
const DEFAULT_NOTIFICATION_MESSAGE_PREVIEW_SETTING = 2 #notificationPreviewNameAndMessage from qml
|
|
||||||
const LSS_KEY_WITHLISTED_UNFURLING_SITES* = "whitelistedUnfurlingSites"
|
const LSS_KEY_WITHLISTED_UNFURLING_SITES* = "whitelistedUnfurlingSites"
|
||||||
const DEFAULT_WITHLISTED_UNFURLING_SITES = ""
|
const DEFAULT_WITHLISTED_UNFURLING_SITES = ""
|
||||||
const LSS_KEY_NEVER_ASK_ABOUT_UNFURLING_AGAIN* = "neverAskAboutUnfurlingAgain"
|
const LSS_KEY_NEVER_ASK_ABOUT_UNFURLING_AGAIN* = "neverAskAboutUnfurlingAgain"
|
||||||
|
@ -101,36 +95,6 @@ const DEFAULT_IS_DDMMYY_DATE_FORMAT = false
|
||||||
const LSS_KEY_IS_24H_TIME_FORMAT* = "is_24h_time_format"
|
const LSS_KEY_IS_24H_TIME_FORMAT* = "is_24h_time_format"
|
||||||
const DEFAULT_IS_24H_TIME_FORMAT = false
|
const DEFAULT_IS_24H_TIME_FORMAT = false
|
||||||
|
|
||||||
# Exemption Keys
|
|
||||||
const EXEMPTION_KEY_MUTE_ALL_MESSAGES* = "muteAllMessages"
|
|
||||||
const EXEMPTION_KEY_PERSONAL_MENTIONS* = "personalMentions"
|
|
||||||
const EXEMPTION_KEY_GLOBAL_MENTIONS* = "globalMentions"
|
|
||||||
const EXEMPTION_KEY_OTHER_MESSAGES* = "otherMessages"
|
|
||||||
|
|
||||||
# Exemption Values
|
|
||||||
const LSS_VALUE_NOTIF_SEND_ALERTS* = "sendAlerts"
|
|
||||||
const LSS_VALUE_NOTIF_SEND_DELIVER_QUIETLY* = "deliverQuietly"
|
|
||||||
const LSS_VALUE_NOTIF_SEND_TURN_OFF* = "turnOff"
|
|
||||||
|
|
||||||
# Notifications
|
|
||||||
const LSS_KEY_NOTIF_SETTING_ALLOW_NOTIFICATIONS* = "allowNotifications"
|
|
||||||
const DEFAULT_NOTIF_SETTING_ALLOW_NOTIFICATIONS = true
|
|
||||||
const LSS_KEY_NOTIF_SETTING_ONE_TO_ONE_CHATS* = "notifSettingOneToOneChats"
|
|
||||||
const DEFAULT_NOTIF_SETTING_ONE_TO_ONE_CHATS = LSS_VALUE_NOTIF_SEND_ALERTS
|
|
||||||
const LSS_KEY_NOTIF_SETTING_GROUP_CHATS* = "notifSettingGroupChats"
|
|
||||||
const DEFAULT_NOTIF_SETTING_GROUP_CHATS = LSS_VALUE_NOTIF_SEND_ALERTS
|
|
||||||
const LSS_KEY_NOTIF_SETTING_PERSONAL_MENTIONS* = "notifSettingPersonalMentions"
|
|
||||||
const DEFAULT_NOTIF_SETTING_PERSONAL_MENTIONS = LSS_VALUE_NOTIF_SEND_ALERTS
|
|
||||||
const LSS_KEY_NOTIF_SETTING_GLOBAL_MENTIONS* = "notifSettingGlobalMentions"
|
|
||||||
const DEFAULT_NOTIF_SETTING_GLOBAL_MENTIONS = LSS_VALUE_NOTIF_SEND_ALERTS
|
|
||||||
const LSS_KEY_NOTIF_SETTING_ALL_MESSAGES* = "notifSettingAllMessages"
|
|
||||||
const DEFAULT_NOTIF_SETTING_ALL_MESSAGES = LSS_VALUE_NOTIF_SEND_TURN_OFF
|
|
||||||
const LSS_KEY_NOTIF_SETTING_CONTACT_REQUESTS* = "notifSettingContactRequests"
|
|
||||||
const DEFAULT_NOTIF_SETTING_CONTACT_REQUESTS = LSS_VALUE_NOTIF_SEND_ALERTS
|
|
||||||
const LSS_KEY_NOTIF_SETTING_IDENTITY_VERIF_REQUESTS* = "notifSettingIdentityVerificationRequests"
|
|
||||||
const DEFAULT_NOTIF_SETTING_IDENTITY_VERIF_REQUESTS = LSS_VALUE_NOTIF_SEND_ALERTS
|
|
||||||
const LSS_KEY_NOTIF_SETTING_EXEMPTIONS* = "notificationsExemptions"
|
|
||||||
const DEFAULT_NOTIF_SETTING_EXEMPTIONS = ""
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "la-sensitive-settings"
|
topics = "la-sensitive-settings"
|
||||||
|
@ -422,44 +386,6 @@ QtObject:
|
||||||
notify = hiddenCommunityBackUpBannersChanged
|
notify = hiddenCommunityBackUpBannersChanged
|
||||||
|
|
||||||
|
|
||||||
proc volumeChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getVolume*(self: LocalAccountSensitiveSettings): int {.slot.} =
|
|
||||||
getSettingsProp[int](self, LSS_KEY_VOLUME, newQVariant(DEFAULT_VOLUME))
|
|
||||||
proc setVolume*(self: LocalAccountSensitiveSettings, value: int) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_VOLUME, newQVariant(value)):
|
|
||||||
self.volumeChanged()
|
|
||||||
QtProperty[int] volume:
|
|
||||||
read = getVolume
|
|
||||||
write = setVolume
|
|
||||||
notify = volumeChanged
|
|
||||||
|
|
||||||
|
|
||||||
proc notificationSoundsEnabledChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotificationSoundsEnabled*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
|
||||||
getSettingsProp[bool](self, LSS_KEY_NOTIFICATION_SOUNDS_ENABLED, newQVariant(DEFAULT_NOTIFICATION_SOUNDS_ENABLED))
|
|
||||||
proc setNotificationSoundsEnabled*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIFICATION_SOUNDS_ENABLED, newQVariant(value)):
|
|
||||||
self.notificationSoundsEnabledChanged()
|
|
||||||
|
|
||||||
QtProperty[bool] notificationSoundsEnabled:
|
|
||||||
read = getNotificationSoundsEnabled
|
|
||||||
write = setNotificationSoundsEnabled
|
|
||||||
notify = notificationSoundsEnabledChanged
|
|
||||||
|
|
||||||
|
|
||||||
proc notificationMessagePreviewSettingChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotificationMessagePreviewSetting*(self: LocalAccountSensitiveSettings): int {.slot.} =
|
|
||||||
getSettingsProp[int](self, LSS_KEY_NOTIFICATION_MESSAGE_PREVIEW_SETTING, newQVariant(DEFAULT_NOTIFICATION_MESSAGE_PREVIEW_SETTING))
|
|
||||||
proc setNotificationMessagePreviewSetting*(self: LocalAccountSensitiveSettings, value: int) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIFICATION_MESSAGE_PREVIEW_SETTING, newQVariant(value)):
|
|
||||||
self.notificationMessagePreviewSettingChanged()
|
|
||||||
|
|
||||||
QtProperty[int] notificationMessagePreviewSetting:
|
|
||||||
read = getNotificationMessagePreviewSetting
|
|
||||||
write = setNotificationMessagePreviewSetting
|
|
||||||
notify = notificationMessagePreviewSettingChanged
|
|
||||||
|
|
||||||
|
|
||||||
proc whitelistedUnfurlingSitesChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
proc whitelistedUnfurlingSitesChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
||||||
proc getWhitelistedUnfurlingSites*(self: LocalAccountSensitiveSettings): QVariant {.slot.} =
|
proc getWhitelistedUnfurlingSites*(self: LocalAccountSensitiveSettings): QVariant {.slot.} =
|
||||||
getSettingsPropQVariant(self, LSS_KEY_WITHLISTED_UNFURLING_SITES, newQVariant(DEFAULT_WITHLISTED_UNFURLING_SITES))
|
getSettingsPropQVariant(self, LSS_KEY_WITHLISTED_UNFURLING_SITES, newQVariant(DEFAULT_WITHLISTED_UNFURLING_SITES))
|
||||||
|
@ -835,117 +761,6 @@ QtObject:
|
||||||
write = setIs24hTimeFormat
|
write = setIs24hTimeFormat
|
||||||
notify = is24hTimeFormatChanged
|
notify = is24hTimeFormatChanged
|
||||||
|
|
||||||
proc notifSettingAllowNotificationsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingAllowNotifications*(self: LocalAccountSensitiveSettings): bool {.slot.} =
|
|
||||||
getSettingsProp[bool](self, LSS_KEY_NOTIF_SETTING_ALLOW_NOTIFICATIONS, newQVariant(DEFAULT_NOTIF_SETTING_ALLOW_NOTIFICATIONS))
|
|
||||||
proc setNotifSettingAllowNotifications*(self: LocalAccountSensitiveSettings, value: bool) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_ALLOW_NOTIFICATIONS, newQVariant(value)):
|
|
||||||
self.notifSettingAllowNotificationsChanged()
|
|
||||||
QtProperty[bool] notifSettingAllowNotifications:
|
|
||||||
read = getNotifSettingAllowNotifications
|
|
||||||
write = setNotifSettingAllowNotifications
|
|
||||||
notify = notifSettingAllowNotificationsChanged
|
|
||||||
|
|
||||||
proc notifSettingOneToOneChatsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingOneToOneChats*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_ONE_TO_ONE_CHATS, newQVariant(DEFAULT_NOTIF_SETTING_ONE_TO_ONE_CHATS))
|
|
||||||
proc setNotifSettingOneToOneChats*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_ONE_TO_ONE_CHATS, newQVariant(value)):
|
|
||||||
self.notifSettingOneToOneChatsChanged()
|
|
||||||
QtProperty[string] notifSettingOneToOneChats:
|
|
||||||
read = getNotifSettingOneToOneChats
|
|
||||||
write = setNotifSettingOneToOneChats
|
|
||||||
notify = notifSettingOneToOneChatsChanged
|
|
||||||
|
|
||||||
proc notifSettingGroupChatsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingGroupChats*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_GROUP_CHATS, newQVariant(DEFAULT_NOTIF_SETTING_GROUP_CHATS))
|
|
||||||
proc setNotifSettingGroupChats*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_GROUP_CHATS, newQVariant(value)):
|
|
||||||
self.notifSettingGroupChatsChanged()
|
|
||||||
QtProperty[string] notifSettingGroupChats:
|
|
||||||
read = getNotifSettingGroupChats
|
|
||||||
write = setNotifSettingGroupChats
|
|
||||||
notify = notifSettingGroupChatsChanged
|
|
||||||
|
|
||||||
proc notifSettingPersonalMentionsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingPersonalMentions*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_PERSONAL_MENTIONS, newQVariant(DEFAULT_NOTIF_SETTING_PERSONAL_MENTIONS))
|
|
||||||
proc setNotifSettingPersonalMentions*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_PERSONAL_MENTIONS, newQVariant(value)):
|
|
||||||
self.notifSettingPersonalMentionsChanged()
|
|
||||||
QtProperty[string] notifSettingPersonalMentions:
|
|
||||||
read = getNotifSettingPersonalMentions
|
|
||||||
write = setNotifSettingPersonalMentions
|
|
||||||
notify = notifSettingPersonalMentionsChanged
|
|
||||||
|
|
||||||
proc notifSettingGlobalMentionsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingGlobalMentions*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_GLOBAL_MENTIONS, newQVariant(DEFAULT_NOTIF_SETTING_GLOBAL_MENTIONS))
|
|
||||||
proc setNotifSettingGlobalMentions*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_GLOBAL_MENTIONS, newQVariant(value)):
|
|
||||||
self.notifSettingGlobalMentionsChanged()
|
|
||||||
QtProperty[string] notifSettingGlobalMentions:
|
|
||||||
read = getNotifSettingGlobalMentions
|
|
||||||
write = setNotifSettingGlobalMentions
|
|
||||||
notify = notifSettingGlobalMentionsChanged
|
|
||||||
|
|
||||||
proc notifSettingAllMessagesChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingAllMessages*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_ALL_MESSAGES, newQVariant(DEFAULT_NOTIF_SETTING_ALL_MESSAGES))
|
|
||||||
proc setNotifSettingAllMessages*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_ALL_MESSAGES, newQVariant(value)):
|
|
||||||
self.notifSettingAllMessagesChanged()
|
|
||||||
QtProperty[string] notifSettingAllMessages:
|
|
||||||
read = getNotifSettingAllMessages
|
|
||||||
write = setNotifSettingAllMessages
|
|
||||||
notify = notifSettingAllMessagesChanged
|
|
||||||
|
|
||||||
proc notifSettingContactRequestsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingContactRequests*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_CONTACT_REQUESTS, newQVariant(DEFAULT_NOTIF_SETTING_CONTACT_REQUESTS))
|
|
||||||
proc setNotifSettingContactRequests*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_CONTACT_REQUESTS, newQVariant(value)):
|
|
||||||
self.notifSettingContactRequestsChanged()
|
|
||||||
QtProperty[string] notifSettingContactRequests:
|
|
||||||
read = getNotifSettingContactRequests
|
|
||||||
write = setNotifSettingContactRequests
|
|
||||||
notify = notifSettingContactRequestsChanged
|
|
||||||
|
|
||||||
proc notifSettingIdentityVerificationRequestsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingIdentityVerificationRequests*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_IDENTITY_VERIF_REQUESTS, newQVariant(DEFAULT_NOTIF_SETTING_IDENTITY_VERIF_REQUESTS))
|
|
||||||
proc setNotifSettingIdentityVerificationRequests*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_IDENTITY_VERIF_REQUESTS, newQVariant(value)):
|
|
||||||
self.notifSettingIdentityVerificationRequestsChanged()
|
|
||||||
QtProperty[string] notifSettingIdentityVerificationRequests:
|
|
||||||
read = getNotifSettingIdentityVerificationRequests
|
|
||||||
write = setNotifSettingIdentityVerificationRequests
|
|
||||||
notify = notifSettingIdentityVerificationRequestsChanged
|
|
||||||
|
|
||||||
proc notifSettingExemptionsChanged*(self: LocalAccountSensitiveSettings) {.signal.}
|
|
||||||
proc getNotifSettingExemptions*(self: LocalAccountSensitiveSettings): string {.slot.} =
|
|
||||||
getSettingsProp[string](self, LSS_KEY_NOTIF_SETTING_EXEMPTIONS, newQVariant(DEFAULT_NOTIF_SETTING_EXEMPTIONS))
|
|
||||||
proc setNotifSettingExemptions*(self: LocalAccountSensitiveSettings, value: string) {.slot.} =
|
|
||||||
setSettingsProp(self, LSS_KEY_NOTIF_SETTING_EXEMPTIONS, newQVariant(value)):
|
|
||||||
self.notifSettingExemptionsChanged()
|
|
||||||
QtProperty[string] notifSettingExemptions:
|
|
||||||
read = getNotifSettingExemptions
|
|
||||||
write = setNotifSettingExemptions
|
|
||||||
notify = notifSettingExemptionsChanged
|
|
||||||
|
|
||||||
proc getNotifSettingExemptionsAsJson*(self: LocalAccountSensitiveSettings): JsonNode =
|
|
||||||
var allExemptions = newJObject()
|
|
||||||
let exemptions = self.getNotifSettingExemptions()
|
|
||||||
if(exemptions.len == 0):
|
|
||||||
return allExemptions
|
|
||||||
try:
|
|
||||||
let exemptionsObj = exemptions.parseJson
|
|
||||||
allExemptions = exemptionsObj
|
|
||||||
except Exception as e:
|
|
||||||
error "stored exemptions are corrupted, will be overwritten", msg=e.msg
|
|
||||||
return allExemptions
|
|
||||||
|
|
||||||
proc removeKey*(self: LocalAccountSensitiveSettings, key: string) =
|
proc removeKey*(self: LocalAccountSensitiveSettings, key: string) =
|
||||||
if(self.settings.isNil):
|
if(self.settings.isNil):
|
||||||
return
|
return
|
||||||
|
@ -971,9 +786,6 @@ QtObject:
|
||||||
of LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS: self.hiddenCommunityWelcomeBannersChanged()
|
of LSS_KEY_HIDDEN_COMMUNITY_WELCOME_BANNERS: self.hiddenCommunityWelcomeBannersChanged()
|
||||||
of LSS_KEY_HIDDEN_COMMUNITY_CHANNELS_AND_CATEGORIES_BANNERS: self.hiddenCommunityChannelAndCategoriesBannersChanged()
|
of LSS_KEY_HIDDEN_COMMUNITY_CHANNELS_AND_CATEGORIES_BANNERS: self.hiddenCommunityChannelAndCategoriesBannersChanged()
|
||||||
of LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS: self.hiddenCommunityBackUpBannersChanged()
|
of LSS_KEY_HIDDEN_COMMUNITY_BACKUP_BANNERS: self.hiddenCommunityBackUpBannersChanged()
|
||||||
of LSS_KEY_VOLUME: self.volumeChanged()
|
|
||||||
of LSS_KEY_NOTIFICATION_SOUNDS_ENABLED: self.notificationSoundsEnabledChanged()
|
|
||||||
of LSS_KEY_NOTIFICATION_MESSAGE_PREVIEW_SETTING: self.notificationMessagePreviewSettingChanged()
|
|
||||||
of LSS_KEY_WITHLISTED_UNFURLING_SITES: self.whitelistedUnfurlingSitesChanged()
|
of LSS_KEY_WITHLISTED_UNFURLING_SITES: self.whitelistedUnfurlingSitesChanged()
|
||||||
of LSS_KEY_NEVER_ASK_ABOUT_UNFURLING_AGAIN: self.neverAskAboutUnfurlingAgainChanged()
|
of LSS_KEY_NEVER_ASK_ABOUT_UNFURLING_AGAIN: self.neverAskAboutUnfurlingAgainChanged()
|
||||||
of LSS_KEY_HIDE_CHANNEL_SUGGESTIONS: self.hideChannelSuggestionsChanged()
|
of LSS_KEY_HIDE_CHANNEL_SUGGESTIONS: self.hideChannelSuggestionsChanged()
|
||||||
|
@ -1003,12 +815,3 @@ QtObject:
|
||||||
of LSS_KEY_STICKERS_ENS_ROPSTEN: self.stickersEnsRopstenChanged()
|
of LSS_KEY_STICKERS_ENS_ROPSTEN: self.stickersEnsRopstenChanged()
|
||||||
of LSS_KEY_IS_DDMMYY_DATE_FORMAT: self.isDDMMYYDateFormatChanged()
|
of LSS_KEY_IS_DDMMYY_DATE_FORMAT: self.isDDMMYYDateFormatChanged()
|
||||||
of LSS_KEY_IS_24H_TIME_FORMAT: self.is24hTimeFormatChanged()
|
of LSS_KEY_IS_24H_TIME_FORMAT: self.is24hTimeFormatChanged()
|
||||||
of LSS_KEY_NOTIF_SETTING_ALLOW_NOTIFICATIONS: self.notifSettingAllowNotificationsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_ONE_TO_ONE_CHATS: self.notifSettingOneToOneChatsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_GROUP_CHATS: self.notifSettingGroupChatsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_PERSONAL_MENTIONS: self.notifSettingPersonalMentionsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_GLOBAL_MENTIONS: self.notifSettingGlobalMentionsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_ALL_MESSAGES: self.notifSettingAllMessagesChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_CONTACT_REQUESTS: self.notifSettingContactRequestsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_IDENTITY_VERIF_REQUESTS: self.notifSettingIdentityVerificationRequestsChanged()
|
|
||||||
of LSS_KEY_NOTIF_SETTING_EXEMPTIONS: self.notifSettingExemptionsChanged()
|
|
|
@ -84,7 +84,7 @@ proc newModule*(delegate: delegate_interface.AccessInterface,
|
||||||
result.advancedModule = advanced_module.newModule(result, events, settingsService, stickersService, nodeConfigurationService)
|
result.advancedModule = advanced_module.newModule(result, events, settingsService, stickersService, nodeConfigurationService)
|
||||||
result.devicesModule = devices_module.newModule(result, events, settingsService, devicesService)
|
result.devicesModule = devices_module.newModule(result, events, settingsService, devicesService)
|
||||||
result.syncModule = sync_module.newModule(result, events, settingsService, mailserversService)
|
result.syncModule = sync_module.newModule(result, events, settingsService, mailserversService)
|
||||||
result.notificationsModule = notifications_module.newModule(result, events, chatService, contactsService)
|
result.notificationsModule = notifications_module.newModule(result, events, settingsService, chatService, contactsService)
|
||||||
result.ensUsernamesModule = ens_usernames_module.newModule(
|
result.ensUsernamesModule = ens_usernames_module.newModule(
|
||||||
result, events, settingsService, ensService, walletAccountService
|
result, events, settingsService, ensService, walletAccountService
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import Tables, chronicles
|
import Tables, chronicles, json
|
||||||
import io_interface
|
import io_interface
|
||||||
|
|
||||||
import ../../../../global/app_signals
|
import ../../../../global/app_signals
|
||||||
import ../../../../core/eventemitter
|
import ../../../../core/eventemitter
|
||||||
|
import ../../../../../app_service/service/settings/service as settings_service
|
||||||
import ../../../../../app_service/service/chat/service as chat_service
|
import ../../../../../app_service/service/chat/service as chat_service
|
||||||
import ../../../../../app_service/service/contacts/service as contact_service
|
import ../../../../../app_service/service/contacts/service as contact_service
|
||||||
import ../../../../../app_service/service/community/service as community_service
|
import ../../../../../app_service/service/community/service as community_service
|
||||||
|
@ -14,16 +15,19 @@ type
|
||||||
Controller* = ref object of RootObj
|
Controller* = ref object of RootObj
|
||||||
delegate: io_interface.AccessInterface
|
delegate: io_interface.AccessInterface
|
||||||
events: EventEmitter
|
events: EventEmitter
|
||||||
|
settingsService: settings_service.Service
|
||||||
chatService: chat_service.Service
|
chatService: chat_service.Service
|
||||||
contactService: contact_service.Service
|
contactService: contact_service.Service
|
||||||
|
|
||||||
proc newController*(delegate: io_interface.AccessInterface,
|
proc newController*(delegate: io_interface.AccessInterface,
|
||||||
events: EventEmitter,
|
events: EventEmitter,
|
||||||
|
settingsService: settings_service.Service,
|
||||||
chatService: chat_service.Service,
|
chatService: chat_service.Service,
|
||||||
contactService: contact_service.Service): Controller =
|
contactService: contact_service.Service): Controller =
|
||||||
result = Controller()
|
result = Controller()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
result.events = events
|
result.events = events
|
||||||
|
result.settingsService = settingsService
|
||||||
result.chatService = chatService
|
result.chatService = chatService
|
||||||
result.contactService = contactService
|
result.contactService = contactService
|
||||||
|
|
||||||
|
@ -88,6 +92,15 @@ proc init*(self: Controller) =
|
||||||
let args = ChatExtArgs(e)
|
let args = ChatExtArgs(e)
|
||||||
self.delegate.addChat(args.chatId)
|
self.delegate.addChat(args.chatId)
|
||||||
|
|
||||||
|
proc getNotifSettingExemptions*(self: Controller, id: string): NotificationsExemptions =
|
||||||
|
return self.settingsService.getNotifSettingExemptions(id)
|
||||||
|
|
||||||
|
proc setNotifSettingExemptions*(self: Controller, id: string, exemptions: NotificationsExemptions): bool =
|
||||||
|
return self.settingsService.setNotifSettingExemptions(id, exemptions)
|
||||||
|
|
||||||
|
proc removeNotifSettingExemptions*(self: Controller, id: string): bool =
|
||||||
|
return self.settingsService.removeNotifSettingExemptions(id)
|
||||||
|
|
||||||
proc getChannelGroups*(self: Controller): seq[ChannelGroupDto] =
|
proc getChannelGroups*(self: Controller): seq[ChannelGroupDto] =
|
||||||
return self.chatService.getChannelGroups()
|
return self.chatService.getChannelGroups()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import ../../../../global/local_account_sensitive_settings
|
import ../../../../../app_service/service/settings/dto/settings
|
||||||
|
|
||||||
type
|
type
|
||||||
Type* {.pure.} = enum
|
Type* {.pure.} = enum
|
||||||
|
@ -20,8 +20,8 @@ type
|
||||||
otherMessages: string
|
otherMessages: string
|
||||||
|
|
||||||
proc initItem*(id, name, image, color: string, joinedTimestamp: int64, itemType: Type, muteAllMessages = false,
|
proc initItem*(id, name, image, color: string, joinedTimestamp: int64, itemType: Type, muteAllMessages = false,
|
||||||
personalMentions = LSS_VALUE_NOTIF_SEND_ALERTS, globalMentions = LSS_VALUE_NOTIF_SEND_ALERTS,
|
personalMentions = VALUE_NOTIF_SEND_ALERTS, globalMentions = VALUE_NOTIF_SEND_ALERTS,
|
||||||
otherMessages = LSS_VALUE_NOTIF_SEND_TURN_OFF): Item =
|
otherMessages = VALUE_NOTIF_TURN_OFF): Item =
|
||||||
result = Item()
|
result = Item()
|
||||||
result.id = id
|
result.id = id
|
||||||
result.name = name
|
result.name = name
|
||||||
|
@ -57,9 +57,9 @@ proc itemType*(self: Item): Type =
|
||||||
|
|
||||||
proc customized*(self: Item): bool =
|
proc customized*(self: Item): bool =
|
||||||
return self.muteAllMessages or
|
return self.muteAllMessages or
|
||||||
self.personalMentions != LSS_VALUE_NOTIF_SEND_ALERTS or
|
self.personalMentions != VALUE_NOTIF_SEND_ALERTS or
|
||||||
self.globalMentions != LSS_VALUE_NOTIF_SEND_ALERTS or
|
self.globalMentions != VALUE_NOTIF_SEND_ALERTS or
|
||||||
self.otherMessages != LSS_VALUE_NOTIF_SEND_TURN_OFF
|
self.otherMessages != VALUE_NOTIF_TURN_OFF
|
||||||
|
|
||||||
proc muteAllMessages*(self: Item): bool =
|
proc muteAllMessages*(self: Item): bool =
|
||||||
return self.muteAllMessages
|
return self.muteAllMessages
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import NimQml, Tables
|
import NimQml, Tables
|
||||||
import item
|
import item
|
||||||
|
|
||||||
import ../../../../global/local_account_sensitive_settings
|
import ../../../../../app_service/service/settings/dto/settings
|
||||||
|
|
||||||
type
|
type
|
||||||
ModelRole {.pure.} = enum
|
ModelRole {.pure.} = enum
|
||||||
|
@ -145,8 +145,8 @@ QtObject:
|
||||||
for i in 0 ..< self.items.len:
|
for i in 0 ..< self.items.len:
|
||||||
yield self.items[i]
|
yield self.items[i]
|
||||||
|
|
||||||
proc updateExemptions*(self: Model, id: string, muteAllMessages = false, personalMentions = LSS_VALUE_NOTIF_SEND_ALERTS,
|
proc updateExemptions*(self: Model, id: string, muteAllMessages = false, personalMentions = VALUE_NOTIF_SEND_ALERTS,
|
||||||
globalMentions = LSS_VALUE_NOTIF_SEND_ALERTS, otherMessages = LSS_VALUE_NOTIF_SEND_TURN_OFF) =
|
globalMentions = VALUE_NOTIF_SEND_ALERTS, otherMessages = VALUE_NOTIF_TURN_OFF) =
|
||||||
let ind = self.findIndexForItemId(id)
|
let ind = self.findIndexForItemId(id)
|
||||||
if(ind == -1):
|
if(ind == -1):
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,6 +6,7 @@ import view, controller, model, item
|
||||||
import ../../../../global/app_signals
|
import ../../../../global/app_signals
|
||||||
import ../../../../global/global_singleton
|
import ../../../../global/global_singleton
|
||||||
import ../../../../core/eventemitter
|
import ../../../../core/eventemitter
|
||||||
|
import ../../../../../app_service/service/settings/service as settings_service
|
||||||
import ../../../../../app_service/service/chat/service as chat_service
|
import ../../../../../app_service/service/chat/service as chat_service
|
||||||
import ../../../../../app_service/service/contacts/service as contact_service
|
import ../../../../../app_service/service/contacts/service as contact_service
|
||||||
from ../../../../../app_service/service/community/dto/community import CommunityDto
|
from ../../../../../app_service/service/community/dto/community import CommunityDto
|
||||||
|
@ -25,13 +26,14 @@ type
|
||||||
|
|
||||||
proc newModule*(delegate: delegate_interface.AccessInterface,
|
proc newModule*(delegate: delegate_interface.AccessInterface,
|
||||||
events: EventEmitter,
|
events: EventEmitter,
|
||||||
|
settingsService: settings_service.Service,
|
||||||
chatService: chat_service.Service,
|
chatService: chat_service.Service,
|
||||||
contactService: contact_service.Service): Module =
|
contactService: contact_service.Service): Module =
|
||||||
result = Module()
|
result = Module()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
result.view = view.newView(result)
|
result.view = view.newView(result)
|
||||||
result.viewVariant = newQVariant(result.view)
|
result.viewVariant = newQVariant(result.view)
|
||||||
result.controller = controller.newController(result, events, chatService, contactService)
|
result.controller = controller.newController(result, events, settingsService, chatService, contactService)
|
||||||
result.moduleLoaded = false
|
result.moduleLoaded = false
|
||||||
|
|
||||||
method delete*(self: Module) =
|
method delete*(self: Module) =
|
||||||
|
@ -52,18 +54,9 @@ method isLoaded*(self: Module): bool =
|
||||||
return self.moduleLoaded
|
return self.moduleLoaded
|
||||||
|
|
||||||
proc createItem(self: Module, id, name, image, color: string, joinedTimestamp: int64, itemType: Type): Item =
|
proc createItem(self: Module, id, name, image, color: string, joinedTimestamp: int64, itemType: Type): Item =
|
||||||
let allExemptions = singletonInstance.localAccountSensitiveSettings.getNotifSettingExemptionsAsJson()
|
let exemptions = self.controller.getNotifSettingExemptions(id)
|
||||||
var item = initItem(id, name, image, color, joinedTimestamp, itemType)
|
var item = initItem(id, name, image, color, joinedTimestamp, itemType, exemptions.muteAllMessages,
|
||||||
if(allExemptions.contains(id)):
|
exemptions.personalMentions, exemptions.globalMentions, exemptions.otherMessages)
|
||||||
let obj = allExemptions[id]
|
|
||||||
if(obj.contains(EXEMPTION_KEY_MUTE_ALL_MESSAGES)):
|
|
||||||
item.muteAllMessages = obj[EXEMPTION_KEY_MUTE_ALL_MESSAGES].getBool
|
|
||||||
if(obj.contains(EXEMPTION_KEY_PERSONAL_MENTIONS)):
|
|
||||||
item.personalMentions = obj[EXEMPTION_KEY_PERSONAL_MENTIONS].getStr
|
|
||||||
if(obj.contains(EXEMPTION_KEY_GLOBAL_MENTIONS)):
|
|
||||||
item.globalMentions = obj[EXEMPTION_KEY_GLOBAL_MENTIONS].getStr
|
|
||||||
if(obj.contains(EXEMPTION_KEY_OTHER_MESSAGES)):
|
|
||||||
item.otherMessages = obj[EXEMPTION_KEY_OTHER_MESSAGES].getStr
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
proc createChatItem(self: Module, chatDto: ChatDto): Item =
|
proc createChatItem(self: Module, chatDto: ChatDto): Item =
|
||||||
|
@ -111,17 +104,12 @@ method sendTestNotification*(self: Module, title: string, message: string) =
|
||||||
|
|
||||||
method saveExemptions*(self: Module, itemId: string, muteAllMessages: bool, personalMentions: string,
|
method saveExemptions*(self: Module, itemId: string, muteAllMessages: bool, personalMentions: string,
|
||||||
globalMentions: string, otherMessages: string) =
|
globalMentions: string, otherMessages: string) =
|
||||||
var allExemptions = singletonInstance.localAccountSensitiveSettings.getNotifSettingExemptionsAsJson()
|
let exemptions = NotificationsExemptions(muteAllMessages: muteAllMessages,
|
||||||
allExemptions[itemId] = %* {
|
personalMentions: personalMentions,
|
||||||
EXEMPTION_KEY_MUTE_ALL_MESSAGES: muteAllMessages,
|
globalMentions: globalMentions,
|
||||||
EXEMPTION_KEY_PERSONAL_MENTIONS: personalMentions,
|
otherMessages: otherMessages)
|
||||||
EXEMPTION_KEY_GLOBAL_MENTIONS: globalMentions,
|
if(self.controller.setNotifSettingExemptions(itemId, exemptions)):
|
||||||
EXEMPTION_KEY_OTHER_MESSAGES: otherMessages
|
self.view.exemptionsModel().updateExemptions(itemId, muteAllMessages, personalMentions, globalMentions, otherMessages)
|
||||||
}
|
|
||||||
|
|
||||||
self.view.exemptionsModel().updateExemptions(itemId, muteAllMessages, personalMentions, globalMentions, otherMessages)
|
|
||||||
|
|
||||||
singletonInstance.localAccountSensitiveSettings.setNotifSettingExemptions($allExemptions)
|
|
||||||
|
|
||||||
method onToggleSection*(self: Module, sectionType: SectionType) =
|
method onToggleSection*(self: Module, sectionType: SectionType) =
|
||||||
if(sectionType != SectionType.Community):
|
if(sectionType != SectionType.Community):
|
||||||
|
@ -137,14 +125,9 @@ method onToggleSection*(self: Module, sectionType: SectionType) =
|
||||||
let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community)
|
let item = self.createItem(cg.id, cg.name, cg.images.thumbnail, cg.color, joinedTimestamp = 0, item.Type.Community)
|
||||||
self.view.exemptionsModel().addItem(item)
|
self.view.exemptionsModel().addItem(item)
|
||||||
else:
|
else:
|
||||||
var allExemptions = singletonInstance.localAccountSensitiveSettings.getNotifSettingExemptionsAsJson()
|
|
||||||
for item in self.view.exemptionsModel().modelIterator():
|
for item in self.view.exemptionsModel().modelIterator():
|
||||||
if(item.itemType != Type.Community):
|
if(item.itemType == Type.Community and self.controller.removeNotifSettingExemptions(item.id)):
|
||||||
continue
|
self.view.exemptionsModel().removeItemById(item.id)
|
||||||
if(allExemptions.contains(item.id)):
|
|
||||||
allExemptions.delete(item.id)
|
|
||||||
self.view.exemptionsModel().removeItemById(item.id)
|
|
||||||
singletonInstance.localAccountSensitiveSettings.setNotifSettingExemptions($allExemptions)
|
|
||||||
|
|
||||||
method addCommunity*(self: Module, communityDto: CommunityDto) =
|
method addCommunity*(self: Module, communityDto: CommunityDto) =
|
||||||
let ind = self.view.exemptionsModel().findIndexForItemId(communityDto.id)
|
let ind = self.view.exemptionsModel().findIndexForItemId(communityDto.id)
|
||||||
|
@ -161,11 +144,8 @@ method editCommunity*(self: Module, communityDto: CommunityDto) =
|
||||||
self.view.exemptionsModel().addItem(item)
|
self.view.exemptionsModel().addItem(item)
|
||||||
|
|
||||||
method removeItemWithId*(self: Module, itemId: string) =
|
method removeItemWithId*(self: Module, itemId: string) =
|
||||||
var allExemptions = singletonInstance.localAccountSensitiveSettings.getNotifSettingExemptionsAsJson()
|
if(self.controller.removeNotifSettingExemptions(itemId)):
|
||||||
if(allExemptions.contains(itemId)):
|
self.view.exemptionsModel().removeItemById(itemId)
|
||||||
allExemptions.delete(itemId)
|
|
||||||
singletonInstance.localAccountSensitiveSettings.setNotifSettingExemptions($allExemptions)
|
|
||||||
self.view.exemptionsModel().removeItemById(itemId)
|
|
||||||
|
|
||||||
method addChat*(self: Module, chatDto: ChatDto) =
|
method addChat*(self: Module, chatDto: ChatDto) =
|
||||||
if chatDto.chatType != ChatType.OneToOne and chatDto.chatType != ChatType.PrivateGroupChat:
|
if chatDto.chatType != ChatType.OneToOne and chatDto.chatType != ChatType.PrivateGroupChat:
|
||||||
|
|
|
@ -47,10 +47,21 @@ const KEY_GIF_API_KEY* = "gifs/api-key"
|
||||||
const KEY_DISPLAY_NAME* = "display-name"
|
const KEY_DISPLAY_NAME* = "display-name"
|
||||||
const KEY_TEST_NETWORKS_ENABLED* = "test-networks-enabled?"
|
const KEY_TEST_NETWORKS_ENABLED* = "test-networks-enabled?"
|
||||||
|
|
||||||
|
# Notifications Settings Values
|
||||||
|
const VALUE_NOTIF_SEND_ALERTS* = "SendAlerts"
|
||||||
|
const VALUE_NOTIF_DELIVER_QUIETLY* = "DeliverQuietly"
|
||||||
|
const VALUE_NOTIF_TURN_OFF* = "TurnOff"
|
||||||
|
|
||||||
const PROFILE_PICTURES_VISIBILITY_CONTACTS_ONLY* = 1
|
const PROFILE_PICTURES_VISIBILITY_CONTACTS_ONLY* = 1
|
||||||
const PROFILE_PICTURES_VISIBILITY_EVERYONE* = 2
|
const PROFILE_PICTURES_VISIBILITY_EVERYONE* = 2
|
||||||
const PROFILE_PICTURES_VISIBILITY_NO_ONE* = 3
|
const PROFILE_PICTURES_VISIBILITY_NO_ONE* = 3
|
||||||
|
|
||||||
|
type NotificationsExemptions* = object
|
||||||
|
muteAllMessages*: bool
|
||||||
|
personalMentions*: string
|
||||||
|
globalMentions*: string
|
||||||
|
otherMessages*: string
|
||||||
|
|
||||||
type UpstreamConfig* = object
|
type UpstreamConfig* = object
|
||||||
Enabled*: bool
|
Enabled*: bool
|
||||||
URL*: string
|
URL*: string
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,3 +9,89 @@ proc getSettings*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
proc saveSettings*(key: string, value: string | JsonNode | bool | int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
proc saveSettings*(key: string, value: string | JsonNode | bool | int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
let payload = %* [key, value]
|
let payload = %* [key, value]
|
||||||
result = core.callPrivateRPC("settings_saveSetting", payload)
|
result = core.callPrivateRPC("settings_saveSetting", payload)
|
||||||
|
|
||||||
|
proc getAllowNotifications*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetAllowNotifications")
|
||||||
|
|
||||||
|
proc setAllowNotifications*(value: bool): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetAllowNotifications", %* [value])
|
||||||
|
|
||||||
|
proc getOneToOneChats*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetOneToOneChats")
|
||||||
|
|
||||||
|
proc setOneToOneChats*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetOneToOneChats", %* [value])
|
||||||
|
|
||||||
|
proc getGroupChats*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetGroupChats")
|
||||||
|
|
||||||
|
proc setGroupChats*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetGroupChats", %* [value])
|
||||||
|
|
||||||
|
proc getPersonalMentions*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetPersonalMentions")
|
||||||
|
|
||||||
|
proc setPersonalMentions*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetPersonalMentions", %* [value])
|
||||||
|
|
||||||
|
proc getGlobalMentions*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetGlobalMentions")
|
||||||
|
|
||||||
|
proc setGlobalMentions*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetGlobalMentions", %* [value])
|
||||||
|
|
||||||
|
proc getAllMessages*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetAllMessages")
|
||||||
|
|
||||||
|
proc setAllMessages*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetAllMessages", %* [value])
|
||||||
|
|
||||||
|
proc getContactRequests*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetContactRequests")
|
||||||
|
|
||||||
|
proc setContactRequests*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetContactRequests", %* [value])
|
||||||
|
|
||||||
|
proc getIdentityVerificationRequests*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetIdentityVerificationRequests")
|
||||||
|
|
||||||
|
proc setIdentityVerificationRequests*(value: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetIdentityVerificationRequests", %* [value])
|
||||||
|
|
||||||
|
proc getSoundEnabled*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetSoundEnabled")
|
||||||
|
|
||||||
|
proc setSoundEnabled*(value: bool): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetSoundEnabled", %* [value])
|
||||||
|
|
||||||
|
proc getVolume*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetVolume")
|
||||||
|
|
||||||
|
proc setVolume*(value: int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetVolume", %* [value])
|
||||||
|
|
||||||
|
proc getMessagePreview*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetMessagePreview")
|
||||||
|
|
||||||
|
proc setMessagePreview*(value: int): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetMessagePreview", %* [value])
|
||||||
|
|
||||||
|
proc getExemptionMuteAllMessages*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetExMuteAllMessages", %* [id])
|
||||||
|
|
||||||
|
proc getExemptionPersonalMentions*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetExPersonalMentions", %* [id])
|
||||||
|
|
||||||
|
proc getExemptionGlobalMentions*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetExGlobalMentions", %* [id])
|
||||||
|
|
||||||
|
proc getExemptionOtherMessages*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_notificationsGetExOtherMessages", %* [id])
|
||||||
|
|
||||||
|
proc setExemptions*(id: string, muteAllMessages: bool, personalMentions: string, globalMentions: string,
|
||||||
|
otherMessages: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
let payload = %* [id, muteAllMessages, personalMentions, globalMentions, otherMessages]
|
||||||
|
return core.callPrivateRPC("settings_notificationsSetExemptions", payload)
|
||||||
|
|
||||||
|
proc deleteExemptions*(id: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
return core.callPrivateRPC("settings_deleteExemptions", %* [id])
|
|
@ -245,9 +245,9 @@ SettingsContentBase {
|
||||||
components: [
|
components: [
|
||||||
StatusSwitch {
|
StatusSwitch {
|
||||||
id: allowNotifSwitch
|
id: allowNotifSwitch
|
||||||
checked: localAccountSensitiveSettings.notifSettingAllowNotifications
|
checked: appSettings.notifSettingAllowNotifications
|
||||||
onClicked: {
|
onClicked: {
|
||||||
localAccountSensitiveSettings.notifSettingAllowNotifications = !localAccountSensitiveSettings.notifSettingAllowNotifications
|
appSettings.notifSettingAllowNotifications = !appSettings.notifSettingAllowNotifications
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -269,10 +269,10 @@ SettingsContentBase {
|
||||||
title: qsTr("1:1 Chats")
|
title: qsTr("1:1 Chats")
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingOneToOneChats
|
selected: appSettings.notifSettingOneToOneChats
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingOneToOneChats = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingOneToOneChats = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingOneToOneChats = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingOneToOneChats = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingOneToOneChats = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingOneToOneChats = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -282,10 +282,10 @@ SettingsContentBase {
|
||||||
title: qsTr("Group Chats")
|
title: qsTr("Group Chats")
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingGroupChats
|
selected: appSettings.notifSettingGroupChats
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingGroupChats = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingGroupChats = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingGroupChats = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingGroupChats = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingGroupChats = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingGroupChats = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -296,10 +296,10 @@ SettingsContentBase {
|
||||||
tertiaryTitle: qsTr("Messages containing @%1").arg(userProfile.name)
|
tertiaryTitle: qsTr("Messages containing @%1").arg(userProfile.name)
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingPersonalMentions
|
selected: appSettings.notifSettingPersonalMentions
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingPersonalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingPersonalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingPersonalMentions = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingPersonalMentions = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingPersonalMentions = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingPersonalMentions = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -310,10 +310,10 @@ SettingsContentBase {
|
||||||
tertiaryTitle: qsTr("Messages containing @here and @channel")
|
tertiaryTitle: qsTr("Messages containing @here and @channel")
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingGlobalMentions
|
selected: appSettings.notifSettingGlobalMentions
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingGlobalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingGlobalMentions = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingGlobalMentions = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingGlobalMentions = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingGlobalMentions = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingGlobalMentions = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -323,10 +323,10 @@ SettingsContentBase {
|
||||||
title: qsTr("All Messages")
|
title: qsTr("All Messages")
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingAllMessages
|
selected: appSettings.notifSettingAllMessages
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingAllMessages = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingAllMessages = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingAllMessages = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingAllMessages = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingAllMessages = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingAllMessages = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -344,10 +344,10 @@ SettingsContentBase {
|
||||||
title: qsTr("Contact Requests")
|
title: qsTr("Contact Requests")
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingContactRequests
|
selected: appSettings.notifSettingContactRequests
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingContactRequests = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingContactRequests = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingContactRequests = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingContactRequests = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingContactRequests = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingContactRequests = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -357,10 +357,10 @@ SettingsContentBase {
|
||||||
title: qsTr("Identity Verification Requests")
|
title: qsTr("Identity Verification Requests")
|
||||||
components: [
|
components: [
|
||||||
NotificationSelect {
|
NotificationSelect {
|
||||||
selected: localAccountSensitiveSettings.notifSettingIdentityVerificationRequests
|
selected: appSettings.notifSettingIdentityVerificationRequests
|
||||||
onSendAlertsClicked: localAccountSensitiveSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.sendAlertsValue
|
onSendAlertsClicked: appSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.sendAlertsValue
|
||||||
onDeliverQuietlyClicked: localAccountSensitiveSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.deliverQuietlyValue
|
onDeliverQuietlyClicked: appSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.deliverQuietlyValue
|
||||||
onTurnOffClicked: localAccountSensitiveSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.turnOffValue
|
onTurnOffClicked: appSettings.notifSettingIdentityVerificationRequests = Constants.settingsSection.notifications.turnOffValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -386,10 +386,10 @@ SettingsContentBase {
|
||||||
notificationTitle: "Vitalik Buterin"
|
notificationTitle: "Vitalik Buterin"
|
||||||
notificationMessage: qsTr("Hi there! So EIP-1559 will defini...")
|
notificationMessage: qsTr("Hi there! So EIP-1559 will defini...")
|
||||||
buttonGroup: messageSetting
|
buttonGroup: messageSetting
|
||||||
checked: localAccountSensitiveSettings.notificationMessagePreviewSetting === Constants.settingsSection.notificationsBubble.previewNameAndMessage
|
checked: appSettings.notificationMessagePreview === Constants.settingsSection.notificationsBubble.previewNameAndMessage
|
||||||
onRadioCheckedChanged: {
|
onRadioCheckedChanged: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
localAccountSensitiveSettings.notificationMessagePreviewSetting = Constants.settingsSection.notificationsBubble.previewNameAndMessage
|
appSettings.notificationMessagePreview = Constants.settingsSection.notificationsBubble.previewNameAndMessage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,10 +401,10 @@ SettingsContentBase {
|
||||||
notificationTitle: "Vitalik Buterin"
|
notificationTitle: "Vitalik Buterin"
|
||||||
notificationMessage: qsTr("You have a new message")
|
notificationMessage: qsTr("You have a new message")
|
||||||
buttonGroup: messageSetting
|
buttonGroup: messageSetting
|
||||||
checked: localAccountSensitiveSettings.notificationMessagePreviewSetting === Constants.settingsSection.notificationsBubble.previewNameOnly
|
checked: appSettings.notificationMessagePreview === Constants.settingsSection.notificationsBubble.previewNameOnly
|
||||||
onRadioCheckedChanged: {
|
onRadioCheckedChanged: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
localAccountSensitiveSettings.notificationMessagePreviewSetting = Constants.settingsSection.notificationsBubble.previewNameOnly
|
appSettings.notificationMessagePreview = Constants.settingsSection.notificationsBubble.previewNameOnly
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -416,10 +416,10 @@ SettingsContentBase {
|
||||||
notificationTitle: "Status"
|
notificationTitle: "Status"
|
||||||
notificationMessage: qsTr("You have a new message")
|
notificationMessage: qsTr("You have a new message")
|
||||||
buttonGroup: messageSetting
|
buttonGroup: messageSetting
|
||||||
checked: localAccountSensitiveSettings.notificationMessagePreviewSetting === Constants.settingsSection.notificationsBubble.previewAnonymous
|
checked: appSettings.notificationMessagePreview === Constants.settingsSection.notificationsBubble.previewAnonymous
|
||||||
onRadioCheckedChanged: {
|
onRadioCheckedChanged: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
localAccountSensitiveSettings.notificationMessagePreviewSetting = Constants.settingsSection.notificationsBubble.previewAnonymous
|
appSettings.notificationMessagePreview = Constants.settingsSection.notificationsBubble.previewAnonymous
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,9 +430,9 @@ SettingsContentBase {
|
||||||
components: [
|
components: [
|
||||||
StatusSwitch {
|
StatusSwitch {
|
||||||
id: soundSwitch
|
id: soundSwitch
|
||||||
checked: localAccountSensitiveSettings.notificationSoundsEnabled
|
checked: appSettings.notificationSoundsEnabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
localAccountSensitiveSettings.notificationSoundsEnabled = !localAccountSensitiveSettings.notificationSoundsEnabled
|
appSettings.notificationSoundsEnabled = !appSettings.notificationSoundsEnabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -466,11 +466,11 @@ SettingsContentBase {
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
localAccountSensitiveSettings.volume = value
|
appSettings.volume = value
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
value = localAccountSensitiveSettings.volume
|
value = appSettings.volume
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,9 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject notifications: QtObject {
|
readonly property QtObject notifications: QtObject {
|
||||||
readonly property string sendAlertsValue: "sendAlerts"
|
readonly property string sendAlertsValue: "SendAlerts"
|
||||||
readonly property string deliverQuietlyValue: "deliverQuietly"
|
readonly property string deliverQuietlyValue: "DeliverQuietly"
|
||||||
readonly property string turnOffValue: "turnOff"
|
readonly property string turnOffValue: "TurnOff"
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject exemptions: QtObject {
|
readonly property QtObject exemptions: QtObject {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7227ae1c8ef1f74e180f324185d01f564730af70
|
Subproject commit 78cba969cc90f463184509c6bde9bcb44d7bb3f9
|
Loading…
Reference in New Issue