aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/entity
diff options
context:
space:
mode:
authorfrosty <gabriel@bwaaa.monster>2026-08-18 12:08:05 -0400
committerfrosty <gabriel@bwaaa.monster>2026-08-18 12:08:05 -0400
commit35108fe1936a280318ad8935b89277f049a6428e (patch)
treef4f82f13eba7c823457ce5b4a5b62b21a178c628 /libdino/src/entity
parent7cf1a12faa2c7781f6277c75702f62f1404752a2 (diff)
Split notification settings
Diffstat (limited to 'libdino/src/entity')
-rw-r--r--libdino/src/entity/conversation.vala10
-rw-r--r--libdino/src/entity/settings.vala78
2 files changed, 87 insertions, 1 deletions
diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala
index 40943132..e6991973 100644
--- a/libdino/src/entity/conversation.vala
+++ b/libdino/src/entity/conversation.vala
@@ -115,12 +115,20 @@ public class Conversation : Object {
}
public NotifySetting get_notification_setting(StreamInteractor stream_interactor) {
- return notify_setting != NotifySetting.DEFAULT ? notify_setting : get_notification_default_setting(stream_interactor);
+ return get_notification_setting_for(stream_interactor, Application.get_default().settings.notifications);
+ }
+
+ public NotifySetting get_notification_setting_for(StreamInteractor stream_interactor, bool notifications_enabled) {
+ if (!notifications_enabled) return NotifySetting.OFF;
+ return notify_setting != NotifySetting.DEFAULT ? notify_setting : get_notification_default_setting_for(stream_interactor);
}
public NotifySetting get_notification_default_setting(StreamInteractor stream_interactor) {
if (!Application.get_default().settings.notifications) return NotifySetting.OFF;
+ return get_notification_default_setting_for(stream_interactor);
+ }
+ private NotifySetting get_notification_default_setting_for(StreamInteractor stream_interactor) {
if (type_ == Type.GROUPCHAT) {
if (stream_interactor.get_module(MucManager.IDENTITY).is_private_room(this.account, this.counterpart)) {
return NotifySetting.ON;
diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala
index 1b533667..8a3eb2fe 100644
--- a/libdino/src/entity/settings.vala
+++ b/libdino/src/entity/settings.vala
@@ -13,6 +13,12 @@ public class Settings : Object {
send_marker_ = col_to_bool_or_default("send_marker", true);
share_time_ = col_to_bool_or_default("share_time", true);
notifications_ = col_to_bool_or_default("notifications", true);
+ notifications_files_ = col_to_bool_or_default("notifications_files", notifications_);
+ notifications_calls_ = col_to_bool_or_default("notifications_calls", true);
+ notifications_subscription_requests_ = col_to_bool_or_default("notifications_subscription_requests", true);
+ notifications_group_chat_invitations_ = col_to_bool_or_default("notifications_group_chat_invitations", true);
+ notifications_permission_requests_ = col_to_bool_or_default("notifications_permission_requests", true);
+ notifications_connection_errors_ = col_to_bool_or_default("notifications_connection_errors", true);
convert_utf8_smileys_ = col_to_bool_or_default("convert_utf8_smileys", true);
check_spelling = col_to_bool_or_default("check_spelling", true);
}
@@ -70,6 +76,78 @@ public class Settings : Object {
}
}
+ private bool notifications_files_;
+ public bool notifications_files {
+ get { return notifications_files_; }
+ set {
+ db.settings.upsert()
+ .value(db.settings.key, "notifications_files", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
+ notifications_files_ = value;
+ }
+ }
+
+ private bool notifications_calls_;
+ public bool notifications_calls {
+ get { return notifications_calls_; }
+ set {
+ db.settings.upsert()
+ .value(db.settings.key, "notifications_calls", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
+ notifications_calls_ = value;
+ }
+ }
+
+ private bool notifications_subscription_requests_;
+ public bool notifications_subscription_requests {
+ get { return notifications_subscription_requests_; }
+ set {
+ db.settings.upsert()
+ .value(db.settings.key, "notifications_subscription_requests", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
+ notifications_subscription_requests_ = value;
+ }
+ }
+
+ private bool notifications_group_chat_invitations_;
+ public bool notifications_group_chat_invitations {
+ get { return notifications_group_chat_invitations_; }
+ set {
+ db.settings.upsert()
+ .value(db.settings.key, "notifications_group_chat_invitations", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
+ notifications_group_chat_invitations_ = value;
+ }
+ }
+
+ private bool notifications_permission_requests_;
+ public bool notifications_permission_requests {
+ get { return notifications_permission_requests_; }
+ set {
+ db.settings.upsert()
+ .value(db.settings.key, "notifications_permission_requests", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
+ notifications_permission_requests_ = value;
+ }
+ }
+
+ private bool notifications_connection_errors_;
+ public bool notifications_connection_errors {
+ get { return notifications_connection_errors_; }
+ set {
+ db.settings.upsert()
+ .value(db.settings.key, "notifications_connection_errors", true)
+ .value(db.settings.value, value.to_string())
+ .perform();
+ notifications_connection_errors_ = value;
+ }
+ }
+
private bool convert_utf8_smileys_;
public bool convert_utf8_smileys {
get { return convert_utf8_smileys_; }