fix android

This commit is contained in:
Lucas Nogueira
2026-03-11 10:41:37 -03:00
parent 479ee98fdc
commit 2a7b2a1079

View File

@@ -128,9 +128,8 @@ macro_rules! android_binding {
android_setup,
prelude::{JClass, JNIEnv, JString},
};
use tauri_runtime_wry::tao::platform::android::prelude::android_fn;
tauri_runtime_wry::wry::android_binding!($domain, $app_name, tauri_runtime_wry);
tauri_runtime_wry::wry::android_binding!($domain, $app_name, tauri_runtime_wry::wry);
tauri_runtime_wry::tao::android_binding!(
$domain,
@@ -1434,6 +1433,12 @@ unsafe impl Send for GtkBox {}
pub struct SendRawWindowHandle(pub raw_window_handle::RawWindowHandle);
unsafe impl Send for SendRawWindowHandle {}
/// Wrapper to send a raw pointer across threads (e.g. from main thread back to plugin setup).
#[cfg(target_os = "ios")]
struct SendPtr(pub *const std::ffi::c_void);
#[cfg(target_os = "ios")]
unsafe impl Send for SendPtr {}
pub enum ApplicationMessage {
#[cfg(target_os = "macos")]
Show,
@@ -1681,6 +1686,19 @@ impl<T: UserEvent> WebviewDispatch<T> for WryWebviewDispatcher<T> {
)
}
#[cfg(target_os = "ios")]
fn ios_webview_ptr(&self) -> Result<*const std::ffi::c_void> {
let (tx, rx) = std::sync::mpsc::channel();
self.with_webview(move |w| {
let ptr = w
.downcast_ref::<Webview>()
.map(|w| w.webview as *const std::ffi::c_void)
.unwrap_or(std::ptr::null());
let _ = tx.send(SendPtr(ptr));
})?;
Ok(rx.recv().map(|p| p.0).unwrap_or(std::ptr::null()))
}
#[cfg(any(debug_assertions, feature = "devtools"))]
fn open_devtools(&self) {
let _ = send_user_message(