Mountain/IPC/AdvancedFeatures/InitializeAdvancedFeatures.rs
1#![allow(non_snake_case)]
2
3//! Bootstrap helper - construct `Features::Struct`, stash a
4//! clone in Tauri state, spawn the monitor tasks. Called from
5//! `Binary/Register/AdvancedFeaturesRegister.rs`.
6
7use std::sync::Arc;
8
9use tauri::Manager;
10
11use crate::{
12 IPC::AdvancedFeatures::Features::Struct as Features,
13 RunTime::ApplicationRunTime::ApplicationRunTime,
14 dev_log,
15};
16
17pub fn initialize_advanced_features(
18 app_handle:&tauri::AppHandle,
19 runtime:Arc<ApplicationRunTime>,
20) -> Result<(), String> {
21 dev_log!("lifecycle", "Initializing advanced IPC features");
22
23 let features = Features::new(runtime);
24
25 app_handle.manage(features.clone());
26
27 let features_clone = features.clone();
28 tokio::spawn(async move {
29 if let Err(e) = features_clone.start_monitoring().await {
30 dev_log!("ipc", "error: [AdvancedFeatures] Failed to start monitoring: {}", e);
31 }
32 });
33
34 Ok(())
35}