|
@@ -6,8 +6,6 @@ use tauri::{
|
|
|
Manager, Runtime,
|
|
|
};
|
|
|
|
|
|
-use std::{collections::HashMap, sync::Mutex};
|
|
|
-
|
|
|
pub use models::*;
|
|
|
|
|
|
#[cfg(desktop)]
|
|
@@ -26,9 +24,6 @@ use desktop::{{ plugin_name_pascal_case }};
|
|
|
#[cfg(mobile)]
|
|
|
use mobile::{{ plugin_name_pascal_case }};
|
|
|
|
|
|
-#[derive(Default)]
|
|
|
-struct MyState(Mutex<HashMap<String, String>>);
|
|
|
-
|
|
|
/// Extensions to [`tauri::App`], [`tauri::AppHandle`] and [`tauri::Window`] to access the {{ plugin_name }} APIs.
|
|
|
pub trait {{ plugin_name_pascal_case }}Ext<R: Runtime> {
|
|
|
fn {{ plugin_name_snake_case }}(&self) -> &{{ plugin_name_pascal_case }}<R>;
|
|
@@ -43,16 +38,13 @@ impl<R: Runtime, T: Manager<R>> crate::{{ plugin_name_pascal_case }}Ext<R> for T
|
|
|
/// Initializes the plugin.
|
|
|
pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
|
|
Builder::new("{{ plugin_name }}")
|
|
|
- .invoke_handler(tauri::generate_handler![commands::execute])
|
|
|
+ .invoke_handler(tauri::generate_handler![commands::ping])
|
|
|
.setup(|app, api| {
|
|
|
#[cfg(mobile)]
|
|
|
let {{ plugin_name_snake_case }} = mobile::init(app, api)?;
|
|
|
#[cfg(desktop)]
|
|
|
let {{ plugin_name_snake_case }} = desktop::init(app, api)?;
|
|
|
app.manage({{ plugin_name_snake_case }});
|
|
|
-
|
|
|
- // manage state so it is accessible by the commands
|
|
|
- app.manage(MyState::default());
|
|
|
Ok(())
|
|
|
})
|
|
|
.build()
|