Skip to content

Commit bfd6cf9

Browse files
committed
Refactor iOS plugin initialization in mobile.rs
Changed the iOS plugin registration to first register the plugin, then send configuration via a method call. Errors during configuration are now logged as warnings instead of causing failure. Removed unused Error import.
1 parent e8d769c commit bfd6cf9

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/mobile.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use tauri::{
66
};
77

88
use crate::models::*;
9-
use crate::Error;
109

1110
#[cfg(target_os = "ios")]
1211
tauri::ios_plugin_binding!(init_plugin_cache);
@@ -69,9 +68,17 @@ pub fn init_with_config<R: Runtime, C: DeserializeOwned>(
6968

7069
#[cfg(target_os = "ios")]
7170
let handle = {
72-
// Pass configuration to iOS
71+
// Register the plugin
72+
let handle = api.register_ios_plugin(init_plugin_cache)?;
73+
74+
// Send configuration through method call (same approach as Android)
7375
let config_json = serde_json::to_string(&config).unwrap_or_default();
74-
api.register_ios_plugin_with_config(init_plugin_cache, config_json)?
76+
if let Err(e) = handle.run_mobile_plugin::<String>("configure", config_json) {
77+
// Log the error but continue
78+
eprintln!("Warning: Failed to configure iOS cache plugin: {}", e);
79+
}
80+
81+
handle
7582
};
7683

7784
Ok(Cache(handle))

0 commit comments

Comments
 (0)