feat: Basic Application Settings (#58)

* .

* .

* .

* update modal
This commit is contained in:
reya
2025-06-13 07:56:59 +07:00
committed by GitHub
parent e687204361
commit cc36adeafe
24 changed files with 1066 additions and 303 deletions

View File

@@ -7,6 +7,7 @@ publish.workspace = true
[dependencies]
common = { path = "../common" }
global = { path = "../global" }
settings = { path = "../settings" }
gpui.workspace = true
nostr.workspace = true

View File

@@ -9,6 +9,7 @@ use global::shared_state;
use gpui::{App, AppContext, Context, EventEmitter, SharedString, Task, Window};
use itertools::Itertools;
use nostr_sdk::prelude::*;
use settings::AppSettings;
use crate::constants::{DAYS_IN_MONTH, HOURS_IN_DAY, MINUTES_IN_HOUR, NOW, SECONDS_IN_MINUTE};
use crate::message::Message;
@@ -249,10 +250,12 @@ impl Room {
/// - For a direct message: the other person's avatar
/// - For a group chat: None
pub fn display_image(&self, cx: &App) -> SharedString {
let proxy = AppSettings::get_global(cx).settings().proxy_user_avatars;
if let Some(picture) = self.picture.as_ref() {
picture.clone()
} else if !self.is_group() {
self.first_member(cx).render_avatar()
self.first_member(cx).render_avatar(proxy)
} else {
"brand/group.png".into()
}
@@ -630,6 +633,7 @@ impl Room {
let subject = self.subject.clone();
let picture = self.picture.clone();
let public_keys = Arc::clone(&self.members);
let backup = AppSettings::get_global(cx).settings().backup_messages;
cx.background_spawn(async move {
let signer = shared_state().client.signer().await?;
@@ -697,7 +701,7 @@ impl Room {
}
// Only send a backup message to current user if there are no issues when sending to others
if reports.is_empty() {
if backup && reports.is_empty() {
if let Err(e) = shared_state()
.client
.send_private_msg(*current_user, &content, tags.clone())