use serde::de::DeserializeOwned; use tauri::{ AppHandle, Runtime, plugin::{PluginApi, PluginHandle}, }; use crate::models::*; #[cfg(target_os = "ios")] tauri::ios_plugin_binding!(init_plugin_auth); // initializes the Kotlin or Swift plugin classes pub fn init( _app: &AppHandle, api: PluginApi, ) -> crate::Result> { #[cfg(target_os = "android")] let handle = api.register_android_plugin("com.plugin.auth", "AuthPlugin")?; #[cfg(target_os = "ios")] let handle = api.register_ios_plugin(init_plugin_auth)?; Ok(Auth(handle)) } /// Access to the auth APIs. pub struct Auth(PluginHandle); impl Auth { pub fn masuk(&self, muatan: SAuthMuatanMasuk) -> crate::Result<()> { return self .0 .run_mobile_plugin("masuk", muatan) .map_err(Into::into); } pub fn keluar(&self) -> crate::Result<()> { return self.0.run_mobile_plugin("keluar", ()).map_err(Into::into); } }