2
0
Fork 0
mirror of https://github.com/DioxusLabs/dioxus synced 2025-03-03 06:47:31 +00:00

Add os-webview feature to wry to fix builds

This commit is contained in:
Jonathan Kelley 2024-01-05 23:25:15 -08:00
parent 2e0cded871
commit e9e7219b4b
No known key found for this signature in database
GPG key ID: 1FBB50F7EB0A08BE
3 changed files with 9 additions and 20 deletions

View file

@ -25,6 +25,7 @@ serde_json = "1.0.79"
thiserror = { workspace = true }
tracing = { workspace = true }
wry = { version = "0.35.0", default-features = false, features = [
"os-webview",
"protocol",
"file-drop",
] }
@ -67,12 +68,6 @@ objc_id = "0.1.1"
core-foundation = "0.9.3"
objc = "0.2.7"
[target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
gtk = { version = "0.18", features = [ "v3_24" ] }
webkit2gtk = { version = "=2.0", features = [ "v2_38" ] }
percent-encoding = "2.1"
[features]
default = ["tokio_runtime", "hot-reload", "wry/objc-exception"]
tokio_runtime = ["tokio"]

View file

@ -82,8 +82,8 @@ impl std::ops::Deref for DesktopService {
impl DesktopService {
pub(crate) fn new(
window: Window,
webview: WebView,
window: Window,
shared: Rc<SharedContext>,
edit_queue: EditQueue,
asset_handlers: AssetHandlerRegistry,

View file

@ -73,15 +73,12 @@ impl WebviewInstance {
// Otherwise, try to serve an asset, either from the user or the filesystem
match index_bytes {
Some(body) => responder.respond(body),
None => {
// we need to do this in the context of the dioxus runtime since the user gave us these closures
protocol::desktop_handler(
request,
asset_handlers_.clone(),
&edit_queue_,
responder,
);
}
None => protocol::desktop_handler(
request,
asset_handlers_.clone(),
&edit_queue_,
responder,
),
}
};
@ -143,11 +140,9 @@ impl WebviewInstance {
webview = webview.with_devtools(true);
}
let webview = webview.build().unwrap();
let desktop_context = Rc::from(DesktopService::new(
webview.build().unwrap(),
window,
webview,
shared.clone(),
edit_queue,
asset_handlers,
@ -161,7 +156,6 @@ impl WebviewInstance {
.provide_context(Rc::new(DesktopEvalProvider::new(desktop_context.clone())));
WebviewInstance {
// We want to poll the virtualdom and the event loop at the same time, so the waker will be connected to both
waker: tao_waker(shared.proxy.clone(), desktop_context.window.id()),
desktop_context,
dom,