Add support for desktop notifications (#192)

This commit is contained in:
Benjamin Grosse 2024-03-22 00:46:46 +00:00 committed by GitHub
parent c63f8d98d5
commit 0c52375e06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 845 additions and 30 deletions

View file

@ -391,6 +391,12 @@ pub enum UserDisplayStyle {
DisplayName,
}
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq)]
pub struct Notifications {
pub enabled: bool,
pub show_message: Option<bool>,
}
#[derive(Clone)]
pub struct ImagePreviewValues {
pub size: ImagePreviewSize,
@ -476,6 +482,7 @@ pub struct TunableValues {
pub message_user_color: bool,
pub default_room: Option<String>,
pub open_command: Option<Vec<String>>,
pub notifications: Notifications,
pub image_preview: Option<ImagePreviewValues>,
}
@ -496,6 +503,7 @@ pub struct Tunables {
pub message_user_color: Option<bool>,
pub default_room: Option<String>,
pub open_command: Option<Vec<String>>,
pub notifications: Option<Notifications>,
pub image_preview: Option<ImagePreview>,
}
@ -518,6 +526,7 @@ impl Tunables {
message_user_color: self.message_user_color.or(other.message_user_color),
default_room: self.default_room.or(other.default_room),
open_command: self.open_command.or(other.open_command),
notifications: self.notifications.or(other.notifications),
image_preview: self.image_preview.or(other.image_preview),
}
}
@ -538,6 +547,7 @@ impl Tunables {
message_user_color: self.message_user_color.unwrap_or(false),
default_room: self.default_room,
open_command: self.open_command,
notifications: self.notifications.unwrap_or_default(),
image_preview: self.image_preview.map(ImagePreview::values),
}
}