Fix: update wry, tao, to fix android issues
This commit is contained in:
9 files changed
+1169
-371
No files matched your search
Generated
+1116
-349
File diff suppressed because it is too large.
Load diff
@@ -36,10 +36,7 @@ frameworks = ["WebKit"]
|
|||||||
anyhow = "1.0.56"
|
anyhow = "1.0.56"
|
||||||
log = "0.4.11"
|
log = "0.4.11"
|
||||||
wry = "0.35.0"
|
wry = "0.35.0"
|
||||||
dioxus = { path = "../../packages/dioxus" }
|
dioxus = { path = "../../packages/dioxus", features = ["mobile"]}
|
||||||
dioxus-desktop = { path = "../../packages/desktop", features = [
|
|
||||||
"tokio_runtime",
|
|
||||||
], default-features = false }
|
|
||||||
|
|
||||||
|
|
||||||
[target.'cfg(target_os = "android")'.dependencies]
|
[target.'cfg(target_os = "android")'.dependencies]
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use dioxus::desktop::Config;
|
use dioxus::mobile::Config;
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
use wry::android_binding;
|
use dioxus::mobile::wry::android_binding;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
fn init_logging() {
|
fn init_logging() {
|
||||||
@@ -49,17 +50,19 @@ pub fn main() -> Result<()> {
|
|||||||
|
|
||||||
// Right now we're going through dioxus-desktop but we'd like to go through dioxus-mobile
|
// Right now we're going through dioxus-desktop but we'd like to go through dioxus-mobile
|
||||||
// That will seed the index.html with some fixes that prevent the page from scrolling/zooming etc
|
// That will seed the index.html with some fixes that prevent the page from scrolling/zooming etc
|
||||||
LaunchBuilder::new().cfg(
|
LaunchBuilder::mobile()
|
||||||
// Note that we have to disable the viewport goofiness of the browser.
|
.with_cfg(
|
||||||
// Dioxus_mobile should do this for us
|
// Note that we have to disable the viewport goofiness of the browser.
|
||||||
Config::default().with_custom_index(include_str!("index.html").to_string()),
|
// Dioxus_mobile should do this for us
|
||||||
);
|
Config::default().with_custom_index(include_str!("index.html").to_string()),
|
||||||
|
)
|
||||||
|
.launch(app);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
let items = cx.use_hook(|| vec![1, 2, 3]);
|
let mut items = use_signal(|| vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
|
||||||
|
|
||||||
log::debug!("Hello from the app");
|
log::debug!("Hello from the app");
|
||||||
|
|
||||||
@@ -74,10 +77,7 @@ fn app() -> Element {
|
|||||||
border: "1px solid black",
|
border: "1px solid black",
|
||||||
button {
|
button {
|
||||||
onclick: move |_| {
|
onclick: move |_| {
|
||||||
println!("Clicked!");
|
|
||||||
items.push(items.len());
|
items.push(items.len());
|
||||||
cx.needs_update_any(ScopeId::ROOT);
|
|
||||||
println!("Requested update");
|
|
||||||
},
|
},
|
||||||
"Add item"
|
"Add item"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ dioxus-html = { workspace = true, features = [
|
|||||||
"eval",
|
"eval",
|
||||||
] }
|
] }
|
||||||
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
|
dioxus-interpreter-js = { workspace = true, features = ["binary-protocol"] }
|
||||||
dioxus-hot-reload = { workspace = true, optional = true }
|
|
||||||
dioxus-cli-config = { workspace = true }
|
dioxus-cli-config = { workspace = true }
|
||||||
generational-box = { workspace = true }
|
generational-box = { workspace = true }
|
||||||
|
|
||||||
@@ -55,6 +54,8 @@ tao = { version = "0.26.1", features = ["rwh_05"] }
|
|||||||
global-hotkey = "0.5.0"
|
global-hotkey = "0.5.0"
|
||||||
rfd = "0.12"
|
rfd = "0.12"
|
||||||
muda = "0.11.3"
|
muda = "0.11.3"
|
||||||
|
# hotreload only works on desktop platforms.... mobile is still wip
|
||||||
|
dioxus-hot-reload = { workspace = true, optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os = "ios")'.dependencies]
|
[target.'cfg(target_os = "ios")'.dependencies]
|
||||||
objc = "0.2.7"
|
objc = "0.2.7"
|
||||||
@@ -65,7 +66,7 @@ core-foundation = "0.9.3"
|
|||||||
objc = "0.2.7"
|
objc = "0.2.7"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["tokio_runtime", "hot-reload", "wry/objc-exception"]
|
default = ["tokio_runtime", "wry/objc-exception", "hot-reload"]
|
||||||
tokio_runtime = ["tokio"]
|
tokio_runtime = ["tokio"]
|
||||||
fullscreen = ["wry/fullscreen"]
|
fullscreen = ["wry/fullscreen"]
|
||||||
transparent = ["wry/transparent"]
|
transparent = ["wry/transparent"]
|
||||||
|
|||||||
@@ -81,7 +81,12 @@ impl App {
|
|||||||
app.set_global_hotkey_handler();
|
app.set_global_hotkey_handler();
|
||||||
|
|
||||||
// Allow hotreloading to work - but only in debug mode
|
// Allow hotreloading to work - but only in debug mode
|
||||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
#[cfg(all(
|
||||||
|
feature = "hot-reload",
|
||||||
|
debug_assertions,
|
||||||
|
not(target_os = "android"),
|
||||||
|
not(target_os = "ios")
|
||||||
|
))]
|
||||||
app.connect_hotreload();
|
app.connect_hotreload();
|
||||||
|
|
||||||
(event_loop, app)
|
(event_loop, app)
|
||||||
@@ -99,7 +104,12 @@ impl App {
|
|||||||
self.shared.shortcut_manager.call_handlers(event);
|
self.shared.shortcut_manager.call_handlers(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
#[cfg(all(
|
||||||
|
feature = "hot-reload",
|
||||||
|
debug_assertions,
|
||||||
|
not(target_os = "android"),
|
||||||
|
not(target_os = "ios")
|
||||||
|
))]
|
||||||
pub fn connect_hotreload(&self) {
|
pub fn connect_hotreload(&self) {
|
||||||
dioxus_hot_reload::connect({
|
dioxus_hot_reload::connect({
|
||||||
let proxy = self.shared.proxy.clone();
|
let proxy = self.shared.proxy.clone();
|
||||||
@@ -265,7 +275,12 @@ impl App {
|
|||||||
view.desktop_context.send_edits();
|
view.desktop_context.send_edits();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
#[cfg(all(
|
||||||
|
feature = "hot-reload",
|
||||||
|
debug_assertions,
|
||||||
|
not(target_os = "android"),
|
||||||
|
not(target_os = "ios")
|
||||||
|
))]
|
||||||
pub fn handle_hot_reload_msg(&mut self, msg: dioxus_hot_reload::HotReloadMsg) {
|
pub fn handle_hot_reload_msg(&mut self, msg: dioxus_hot_reload::HotReloadMsg) {
|
||||||
match msg {
|
match msg {
|
||||||
dioxus_hot_reload::HotReloadMsg::UpdateTemplate(template) => {
|
dioxus_hot_reload::HotReloadMsg::UpdateTemplate(template) => {
|
||||||
|
|||||||
@@ -14,7 +14,12 @@ pub enum UserWindowEvent {
|
|||||||
Ipc { id: WindowId, msg: IpcMessage },
|
Ipc { id: WindowId, msg: IpcMessage },
|
||||||
|
|
||||||
/// Handle a hotreload event, basically telling us to update our templates
|
/// Handle a hotreload event, basically telling us to update our templates
|
||||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
#[cfg(all(
|
||||||
|
feature = "hot-reload",
|
||||||
|
debug_assertions,
|
||||||
|
not(target_os = "android"),
|
||||||
|
not(target_os = "ios")
|
||||||
|
))]
|
||||||
HotReloadEvent(dioxus_hot_reload::HotReloadMsg),
|
HotReloadEvent(dioxus_hot_reload::HotReloadMsg),
|
||||||
|
|
||||||
/// Create a new window
|
/// Create a new window
|
||||||
|
|||||||
@@ -36,7 +36,12 @@ pub fn launch_virtual_dom_blocking(virtual_dom: VirtualDom, desktop_config: Conf
|
|||||||
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "windows", target_os = "linux", target_os = "macos"))]
|
||||||
UserWindowEvent::GlobalHotKeyEvent(evnt) => app.handle_global_hotkey(evnt),
|
UserWindowEvent::GlobalHotKeyEvent(evnt) => app.handle_global_hotkey(evnt),
|
||||||
|
|
||||||
#[cfg(all(feature = "hot-reload", debug_assertions))]
|
#[cfg(all(
|
||||||
|
feature = "hot-reload",
|
||||||
|
debug_assertions,
|
||||||
|
not(target_os = "android"),
|
||||||
|
not(target_os = "ios")
|
||||||
|
))]
|
||||||
UserWindowEvent::HotReloadEvent(msg) => app.handle_hot_reload_msg(msg),
|
UserWindowEvent::HotReloadEvent(msg) => app.handle_hot_reload_msg(msg),
|
||||||
|
|
||||||
UserWindowEvent::Ipc { id, msg } => match msg.method() {
|
UserWindowEvent::Ipc { id, msg } => match msg.method() {
|
||||||
|
|||||||
@@ -221,6 +221,7 @@ impl WebviewInstance {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unused)]
|
||||||
pub fn kick_stylsheets(&self) {
|
pub fn kick_stylsheets(&self) {
|
||||||
// run eval in the webview to kick the stylesheets by appending a query string
|
// run eval in the webview to kick the stylesheets by appending a query string
|
||||||
// we should do something less clunky than this
|
// we should do something less clunky than this
|
||||||
|
|||||||
@@ -226,3 +226,10 @@ pub fn launch_desktop(app: fn() -> Element) {
|
|||||||
pub fn launch_fullstack(app: fn() -> Element) {
|
pub fn launch_fullstack(app: fn() -> Element) {
|
||||||
LaunchBuilder::fullstack().launch(app)
|
LaunchBuilder::fullstack().launch(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "mobile")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "mobile")))]
|
||||||
|
/// Launch your mobile application without any additional configuration. See [`LaunchBuilder`] for more options.
|
||||||
|
pub fn launch_mobile(app: fn() -> Element) {
|
||||||
|
LaunchBuilder::mobile().launch(app)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user