minor consolidation & handling of data from frontend to rust side
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
// in app-core/src/state.rs
|
||||
use crate::{
|
||||
lock_w, models::app_data::UserData, services::presence_modules::models::ModuleMetadata,
|
||||
lock_w,
|
||||
models::{app_data::UserData, dolls::DollDto},
|
||||
services::{
|
||||
cursor::CursorPositions,
|
||||
presence_modules::models::ModuleMetadata,
|
||||
},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, LazyLock, RwLock};
|
||||
use tauri::tray::TrayIcon;
|
||||
use tracing::info;
|
||||
@@ -20,12 +26,26 @@ pub struct Modules {
|
||||
pub metadatas: Vec<ModuleMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct FriendSceneRuntimeState {
|
||||
pub cursor_positions: HashMap<String, CursorPositions>,
|
||||
pub active_dolls: HashMap<String, Option<DollDto>>,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct PresenceRuntimeState {
|
||||
pub current: Option<crate::models::event_payloads::UserStatusPayload>,
|
||||
pub friends: HashMap<String, crate::models::event_payloads::UserStatusPayload>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AppState {
|
||||
pub app_config: crate::services::client_config_manager::AppConfig,
|
||||
pub network: NetworkState,
|
||||
pub auth: AuthState,
|
||||
pub user_data: UserData,
|
||||
pub friend_scene: FriendSceneRuntimeState,
|
||||
pub presence: PresenceRuntimeState,
|
||||
pub tray: Option<TrayIcon>,
|
||||
pub modules: Modules,
|
||||
}
|
||||
@@ -45,6 +65,8 @@ pub fn init_app_state() {
|
||||
guard.network = init_network_state();
|
||||
guard.auth = init_auth_state();
|
||||
guard.user_data = UserData::default();
|
||||
guard.friend_scene = FriendSceneRuntimeState::default();
|
||||
guard.presence = PresenceRuntimeState::default();
|
||||
guard.modules = Modules::default();
|
||||
}
|
||||
update_display_dimensions_for_scene_state();
|
||||
|
||||
Reference in New Issue
Block a user