diff --git a/examples/ios_demo/Cargo.toml b/examples/ios_demo/Cargo.toml index 8034ec8d8..76b4fbc6e 100644 --- a/examples/ios_demo/Cargo.toml +++ b/examples/ios_demo/Cargo.toml @@ -38,6 +38,7 @@ log = "0.4.11" im-rc = "15.1.0" dioxus = { path = "../../packages/dioxus" } dioxus-desktop = { path = "../../packages/desktop" } +wry = { version = "0.27.2" } [target.'cfg(target_os = "android")'.dependencies] android_logger = "0.9.0" diff --git a/examples/ios_demo/README.md b/examples/ios_demo/README.md index b9ca33fe4..a6877b276 100644 --- a/examples/ios_demo/README.md +++ b/examples/ios_demo/README.md @@ -33,3 +33,13 @@ From there, just click the "play" button with the right target and the app shoul Note that clicking play doesn't cause a new build, so you'll need to keep rebuilding the app between changes. The tooling here is very young, so please be patient. If you want to contribute to make things easier, please do! We'll be happy to help. + +## Running on Android + +Again, we want to make sure we have the right targets installed. + +The common targets here are +- aarch64-linux-android +- armv7-linux-androideabi +- i686-linux-android +- x86_64-linux-android diff --git a/examples/ios_demo/src/lib.rs b/examples/ios_demo/src/lib.rs index a85282bb7..bf433beb1 100644 --- a/examples/ios_demo/src/lib.rs +++ b/examples/ios_demo/src/lib.rs @@ -1,5 +1,7 @@ use anyhow::Result; use dioxus::prelude::*; +#[cfg(target_os = "android")] +use wry::android_binding; pub fn main() -> Result<()> { init_logging(); @@ -70,8 +72,6 @@ fn _start_app() { } use dioxus_desktop::Config; -#[cfg(target_os = "android")] -use wry::android_binding; #[no_mangle] #[inline(never)] diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index d5bc040a7..59d0df937 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -39,7 +39,8 @@ slab = { workspace = true } futures-util = { workspace = true } urlencoding = "2.1.2" -[target.'cfg(not(target_os = "ios"))'.dependencies] + +[target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies] rfd = "0.11.3" [target.'cfg(target_os = "ios")'.dependencies] diff --git a/packages/desktop/src/file_upload.rs b/packages/desktop/src/file_upload.rs index c7bb113c8..d09783bcf 100644 --- a/packages/desktop/src/file_upload.rs +++ b/packages/desktop/src/file_upload.rs @@ -13,12 +13,28 @@ pub(crate) struct FileDialogRequest { pub bubbles: bool, } -#[cfg(target_os = "ios")] +#[cfg(not(any( + target_os = "windows", + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +)))] pub(crate) fn get_file_event(_request: &FileDialogRequest) -> Vec { vec![] } -#[cfg(not(target_os = "ios"))] +#[cfg(any( + target_os = "windows", + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" +))] pub(crate) fn get_file_event(request: &FileDialogRequest) -> Vec { let mut dialog = rfd::FileDialog::new(); diff --git a/packages/desktop/src/shortcut.rs b/packages/desktop/src/shortcut.rs index 5f46682e8..ffc64a232 100644 --- a/packages/desktop/src/shortcut.rs +++ b/packages/desktop/src/shortcut.rs @@ -113,7 +113,15 @@ impl ShortcutRegistry { callbacks.remove(id.number); if callbacks.is_empty() { if let Some(_shortcut) = shortcuts.remove(&id.id) { - #[cfg(not(target_os = "ios"))] + #[cfg(any( + target_os = "windows", + target_os = "macos", + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ))] let _ = self.manager.borrow_mut().unregister(_shortcut.shortcut); } }