FIx desktop for android

This commit is contained in:
Jonathan Kelley committed 2023-07-05 12:49:41 -07:00
1 parent 4343abf76d
commit 2ce8ded74d
6 files changed
+42 -6

No files matched your search

+1
View File
@@ -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"
+10
View File
@@ -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
+2 -2
View File
@@ -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)]
+2 -1
View File
@@ -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]
+18 -2
View File
@@ -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<PathBuf> {
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<PathBuf> {
let mut dialog = rfd::FileDialog::new();
+9 -1
View File
@@ -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);
}
}