🎨 Merge app_settings.rs and base.rs files

This commit is contained in:
2023-08-09 22:40:11 +02:00
parent fd80b7fc10
commit 2bbee1633f
2 changed files with 15 additions and 34 deletions

View File

@@ -1,31 +0,0 @@
use std::cell::RefCell;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use crate::base::Store;
use crate::matrix_client::Requester;
#[derive(Debug, Clone)]
pub struct AppSettings {
// pub matrix_client: Option<Arc<Mutex<MatrixClient>>>,
// pub matrix_client: Arc<MatrixClient>,
// pub matrix_client: Rc<RefCell<MatrixClient>>,
// pub matrix_client: Arc<MatrixClient>,
//pub matrix_client: Arc<Mutex<MatrixClient>>,
pub requester: Option<Arc<Requester>>,
pub store: Store,
}
impl AppSettings {
pub fn new() -> Self {
Self {
// matrix_client: Arc::new(MatrixClient::new()),
//matrix_client: Arc::new(Mutex::new(MatrixClient::new())),
requester: None,
store: Store::new(),
// matrix_client: Arc::new(Mutex::new(MatrixClient::new())),
// matrix_client: Arc::new(MatrixClient::new()),
// matrix_client: Rc::new(RefCell::new(MatrixClient::new())),
}
}
}

View File

@@ -1,13 +1,25 @@
use std::sync::Arc;
use crate::matrix_client::Requester;
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
pub struct Store { pub struct Store {
pub is_logged: bool, pub is_logged: bool,
} }
// pub type ProgramStore = Store<Info>;
// pub type AsyncProgramStore = Arc<AsyncMutex<ProgramStore>>;
impl Store { impl Store {
pub fn new() -> Self { pub fn new() -> Self {
Self { is_logged: false } Self { is_logged: false }
} }
} }
#[derive(Clone)]
pub struct AppSettings {
pub requester: Option<Arc<Requester>>,
}
impl AppSettings {
pub fn new() -> Self {
Self { requester: None }
}
}