refactored app startup flow
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
// in app-core/src/state.rs
|
||||
use crate::{lock_w};
|
||||
use std::{
|
||||
sync::{Arc, LazyLock, RwLock},
|
||||
};
|
||||
use crate::lock_w;
|
||||
use std::sync::{Arc, LazyLock, RwLock};
|
||||
use tauri::tray::TrayIcon;
|
||||
use tracing::info;
|
||||
|
||||
mod network;
|
||||
mod auth;
|
||||
mod network;
|
||||
mod ui;
|
||||
|
||||
pub use network::*;
|
||||
pub use auth::*;
|
||||
pub use network::*;
|
||||
pub use ui::*;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -20,7 +18,6 @@ pub struct AppState {
|
||||
pub network: NetworkState,
|
||||
pub auth: AuthState,
|
||||
pub ui: UiState,
|
||||
pub tracing_guard: Option<tracing_appender::non_blocking::WorkerGuard>,
|
||||
pub tray: Option<TrayIcon>,
|
||||
}
|
||||
|
||||
@@ -29,11 +26,10 @@ pub struct AppState {
|
||||
pub static FDOLL: LazyLock<Arc<RwLock<AppState>>> =
|
||||
LazyLock::new(|| Arc::new(RwLock::new(AppState::default())));
|
||||
|
||||
pub fn init_fdoll_state(tracing_guard: Option<tracing_appender::non_blocking::WorkerGuard>) {
|
||||
pub fn init_fdoll_state() {
|
||||
{
|
||||
let mut guard = lock_w!(FDOLL);
|
||||
dotenvy::dotenv().ok();
|
||||
guard.tracing_guard = tracing_guard;
|
||||
guard.app_config = crate::services::client_config_manager::load_app_config();
|
||||
guard.network = init_network_state();
|
||||
guard.auth = init_auth_state();
|
||||
|
||||
Reference in New Issue
Block a user