Skip to main content

Mountain/IPC/AdvancedFeatures/
InitializeAdvancedFeatures.rs

1
2//! Bootstrap helper - construct `Features::Struct`, stash a
3//! clone in Tauri state, spawn the monitor tasks. Called from
4//! `Binary/Register/AdvancedFeaturesRegister.rs`.
5
6use std::sync::Arc;
7
8use tauri::Manager;
9
10use crate::{
11	IPC::AdvancedFeatures::Features::Struct as Features,
12	RunTime::ApplicationRunTime::ApplicationRunTime,
13	dev_log,
14};
15
16pub fn initialize_advanced_features(
17	app_handle:&tauri::AppHandle,
18
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
29	tokio::spawn(async move {
30		if let Err(e) = features_clone.start_monitoring().await {
31			dev_log!("ipc", "error: [AdvancedFeatures] Failed to start monitoring: {}", e);
32		}
33	});
34
35	Ok(())
36}