Skip to main content

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
20	runtime:Arc<ApplicationRunTime>,
21) -> Result<(), String> {
22	dev_log!("lifecycle", "Initializing advanced IPC features");
23
24	let features = Features::new(runtime);
25
26	app_handle.manage(features.clone());
27
28	let features_clone = features.clone();
29
30	tokio::spawn(async move {
31		if let Err(e) = features_clone.start_monitoring().await {
32			dev_log!("ipc", "error: [AdvancedFeatures] Failed to start monitoring: {}", e);
33		}
34	});
35
36	Ok(())
37}