lighty_tauri/
lib.rs

1pub mod commands;
2pub mod core;
3
4#[cfg(feature = "events")]
5pub mod events;
6
7// Re-export for convenience
8pub use commands::*;
9pub use core::*;
10
11#[cfg(feature = "events")]
12pub use events::*;
13
14#[cfg(feature = "tauri-commands")]
15use tauri::{plugin::TauriPlugin, Runtime};
16
17/// Creates the Lighty Launcher Tauri plugin with all commands registered
18///
19/// # Example
20/// ```no_run
21/// use lighty_launcher::tauri::lighty_plugin;
22///
23/// #[cfg_attr(mobile, tauri::mobile_entry_point)]
24/// pub fn run() {
25///     tauri::Builder::default()
26///         .plugin(lighty_plugin())
27///         .run(tauri::generate_context!())
28///         .expect("error running tauri application");
29/// }
30/// ```
31#[cfg(feature = "tauri-commands")]
32pub fn lighty_plugin<R: Runtime>() -> TauriPlugin<R> {
33    use crate::commands::*;
34
35    tauri::plugin::Builder::new("lighty-launcher")
36        .invoke_handler(tauri::generate_handler![
37            init_app_state,
38            get_launcher_path,
39            authenticate_offline,
40            authenticate_microsoft,
41            authenticate_azuriom,
42            launch,
43            get_java_distributions,
44            get_loaders,
45            check_version_exists,
46        ])
47        .build()
48}
49