Add os-webview feature to wry to fix builds

This commit is contained in:
Jonathan Kelley committed 2024-01-05 23:25:15 -08:00
1 parent 2e0cded871
commit e9e7219b4b
3 files changed
+9 -20

No files matched your search

+1 -6
View File
@@ -25,6 +25,7 @@ serde_json = "1.0.79"
thiserror = { workspace = true } thiserror = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
wry = { version = "0.35.0", default-features = false, features = [ wry = { version = "0.35.0", default-features = false, features = [
"os-webview",
"protocol", "protocol",
"file-drop", "file-drop",
] } ] }
@@ -67,12 +68,6 @@ objc_id = "0.1.1"
core-foundation = "0.9.3" core-foundation = "0.9.3"
objc = "0.2.7" 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] [features]
default = ["tokio_runtime", "hot-reload", "wry/objc-exception"] default = ["tokio_runtime", "hot-reload", "wry/objc-exception"]
tokio_runtime = ["tokio"] tokio_runtime = ["tokio"]
+1 -1
View File
@@ -82,8 +82,8 @@ impl std::ops::Deref for DesktopService {
impl DesktopService { impl DesktopService {
pub(crate) fn new( pub(crate) fn new(
window: Window,
webview: WebView, webview: WebView,
window: Window,
shared: Rc<SharedContext>, shared: Rc<SharedContext>,
edit_queue: EditQueue, edit_queue: EditQueue,
asset_handlers: AssetHandlerRegistry, asset_handlers: AssetHandlerRegistry,
+7 -13
View File
@@ -73,15 +73,12 @@ impl WebviewInstance {
// Otherwise, try to serve an asset, either from the user or the filesystem // Otherwise, try to serve an asset, either from the user or the filesystem
match index_bytes { match index_bytes {
Some(body) => responder.respond(body), Some(body) => responder.respond(body),
None => { None => protocol::desktop_handler(
// we need to do this in the context of the dioxus runtime since the user gave us these closures request,
protocol::desktop_handler( asset_handlers_.clone(),
request, &edit_queue_,
asset_handlers_.clone(), responder,
&edit_queue_, ),
responder,
);
}
} }
}; };
@@ -143,11 +140,9 @@ impl WebviewInstance {
webview = webview.with_devtools(true); webview = webview.with_devtools(true);
} }
let webview = webview.build().unwrap();
let desktop_context = Rc::from(DesktopService::new( let desktop_context = Rc::from(DesktopService::new(
webview.build().unwrap(),
window, window,
webview,
shared.clone(), shared.clone(),
edit_queue, edit_queue,
asset_handlers, asset_handlers,
@@ -161,7 +156,6 @@ impl WebviewInstance {
.provide_context(Rc::new(DesktopEvalProvider::new(desktop_context.clone()))); .provide_context(Rc::new(DesktopEvalProvider::new(desktop_context.clone())));
WebviewInstance { 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()), waker: tao_waker(shared.proxy.clone(), desktop_context.window.id()),
desktop_context, desktop_context,
dom, dom,