diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d128f82..48af0d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,7 @@ jobs: with: toolchain: 'nightly' components: 'clippy,rust-docs' + - name: Install alsa and udev run: | sudo apt-get update && sudo apt-get install --no-install-recommends libasound2-dev \ @@ -40,10 +41,10 @@ jobs: uses: Swatinem/rust-cache@v2 - name: Clippy all features - run: cargo clippy --all-features --tests -- -D warnings + run: cargo clippy --all --all-features --tests -- -D warnings - name: Test all features - run: cargo test --all-features + run: cargo test --all-features --all - name: Doc lint run: cargo +nightly doc --all-features --no-deps diff --git a/Cargo.toml b/Cargo.toml index 49a0406..fbd2949 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,8 @@ license = "MIT OR Apache-2.0" edition = "2021" [workspace.dependencies] -bevy = { version = "0.15", default-features = false } -bevy_flurx = { version = "0.9" } +bevy = { version = "0.16", default-features = false } +bevy_flurx = { version = "0.11" } bevy_flurx_ipc = { path = "crates/bevy_flurx_ipc", version = "0.3" } bevy_flurx_ipc_macro = { path = "crates/bevy_flurx_ipc_macro", version = "0.3" } bevy_webview_core = { path = "crates/bevy_webview_core", version = "0.3" } diff --git a/crates/bevy_flurx_api/CHANGELOG.md b/crates/bevy_flurx_api/CHANGELOG.md index 72a1535..d1c131e 100644 --- a/crates/bevy_flurx_api/CHANGELOG.md +++ b/crates/bevy_flurx_api/CHANGELOG.md @@ -1,3 +1,9 @@ +## Unreleased + +## Features + +- Upgrade bevy's version to v0.16.0 + ## v0.3.0 [Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.3.0) diff --git a/crates/bevy_flurx_api/Cargo.toml b/crates/bevy_flurx_api/Cargo.toml index 6d01014..697a258 100644 --- a/crates/bevy_flurx_api/Cargo.toml +++ b/crates/bevy_flurx_api/Cargo.toml @@ -18,7 +18,7 @@ notification = ["dep:notify-rust"] os = ["dep:sysinfo", "dep:sys-locale"] monitor = [] web_window = ["dep:winit"] -http = ["bevy_flurx/tokio", "bevy_flurx/effect", "dep:reqwest"] +http = ["bevy_flurx/tokio", "bevy_flurx/side-effect", "dep:reqwest"] full = [ "fs", "clipboard", @@ -40,13 +40,13 @@ dirs = { version = "6", optional = true } arboard = { version = "3", optional = true } rfd = { version = "0.15", default-features = false, optional = true } notify-rust = { version = "4", optional = true } -sysinfo = { version = "0.33", optional = true } +sysinfo = { version = "0.34", optional = true } sys-locale = { version = "0.3", optional = true } winit = { version = "0.30", features = ["serde"], optional = true } reqwest = { version = "0.12", features = ["json"], optional = true } [dev-dependencies] -bevy = "0.15" +bevy = "0.16" bevy_webview_wry = { path = "../bevy_webview_wry" } [lints] diff --git a/crates/bevy_flurx_api/src/http.rs b/crates/bevy_flurx_api/src/http.rs index 2ac66ba..29d26d2 100644 --- a/crates/bevy_flurx_api/src/http.rs +++ b/crates/bevy_flurx_api/src/http.rs @@ -4,8 +4,8 @@ use crate::error::http::DenyOrigin; use crate::error::ApiResult; use crate::macros::api_plugin; use bevy::app::PluginGroupBuilder; +use bevy::platform::collections::hash_map::HashMap; use bevy::prelude::{In, PluginGroup, Reflect, ReflectDefault, ReflectDeserialize, ReflectResource, ReflectSerialize, Res, Resource, Update}; -use bevy::utils::HashMap; use bevy_flurx::prelude::{once, side_effect, Pipe}; use bevy_flurx::task::ReactorTask; use bevy_flurx_ipc::prelude::*; diff --git a/crates/bevy_flurx_api/src/lib.rs b/crates/bevy_flurx_api/src/lib.rs index f5fd616..502aaeb 100644 --- a/crates/bevy_flurx_api/src/lib.rs +++ b/crates/bevy_flurx_api/src/lib.rs @@ -110,7 +110,7 @@ mod tests { }); app.update(); app.world_mut().run_system_once(move |handlers: Query<&IpcHandlers>| { - assert!(handlers.single().get(ipc_id).is_some()); + assert!(handlers.single().expect("Parent window not found").get(ipc_id).is_some()); }).expect("Failed to run system"); } } \ No newline at end of file diff --git a/crates/bevy_flurx_api/src/web_window/create.rs b/crates/bevy_flurx_api/src/web_window/create.rs index 0dab856..3f462cf 100644 --- a/crates/bevy_flurx_api/src/web_window/create.rs +++ b/crates/bevy_flurx_api/src/web_window/create.rs @@ -1,6 +1,5 @@ use crate::macros::api_plugin; -use bevy::core::Name; -use bevy::prelude::{Commands, In}; +use bevy::prelude::{Commands, In, Name}; use bevy::utils::default; use bevy::window::{Window, WindowResolution}; use bevy_flurx::action::once; diff --git a/crates/bevy_flurx_api/src/web_window/set_window_mode.rs b/crates/bevy_flurx_api/src/web_window/set_window_mode.rs index eef629e..8ca90d1 100644 --- a/crates/bevy_flurx_api/src/web_window/set_window_mode.rs +++ b/crates/bevy_flurx_api/src/web_window/set_window_mode.rs @@ -1,10 +1,10 @@ use crate::macros::api_plugin; use crate::web_window::WebWinitWindowParams; -use bevy::prelude::{In, MonitorSelection}; +use bevy::prelude::{In, MonitorSelection, VideoModeSelection}; use bevy::window::WindowMode; use bevy_flurx::action::{once, Action}; -use serde::Deserialize; use bevy_flurx_ipc::prelude::*; +use serde::Deserialize; api_plugin!( /// You'll be able to set fullscreen state of the window decorations from a webview. @@ -41,7 +41,7 @@ fn system( return; }; window.mode = match args.1 { - VideoModeState::Fullscreen => WindowMode::Fullscreen(MonitorSelection::Current), + VideoModeState::Fullscreen => WindowMode::Fullscreen(MonitorSelection::Current, VideoModeSelection::Current), VideoModeState::Borderless => WindowMode::BorderlessFullscreen(MonitorSelection::Current), VideoModeState::Windowed => WindowMode::Windowed }; diff --git a/crates/bevy_flurx_ipc/CHANGELOG.md b/crates/bevy_flurx_ipc/CHANGELOG.md index 7b1375b..b102f35 100644 --- a/crates/bevy_flurx_ipc/CHANGELOG.md +++ b/crates/bevy_flurx_ipc/CHANGELOG.md @@ -1,3 +1,9 @@ +## Unreleased + +## Features + +- Upgrade bevy's version to v0.16.0 + ## v0.3.0 [Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.3.0) diff --git a/crates/bevy_flurx_ipc/Cargo.toml b/crates/bevy_flurx_ipc/Cargo.toml index b3f2724..71e176d 100644 --- a/crates/bevy_flurx_ipc/Cargo.toml +++ b/crates/bevy_flurx_ipc/Cargo.toml @@ -15,7 +15,7 @@ name = "progress" path = "tests/index.rs" [dependencies] -bevy = { workspace = true, features = ["serialize"] } +bevy = { workspace = true, features = ["serialize", "bevy_log"] } bevy_flurx_ipc_macro = { workspace = true } bevy_flurx = { workspace = true } serde = { workspace = true } @@ -23,7 +23,7 @@ serde_json = { workspace = true } [dev-dependencies] trybuild = "1" -bevy = "0.15" +bevy = { workspace = true } [lints] workspace = true diff --git a/crates/bevy_flurx_ipc/src/component.rs b/crates/bevy_flurx_ipc/src/component.rs index ec2d6d5..58f9b48 100644 --- a/crates/bevy_flurx_ipc/src/component.rs +++ b/crates/bevy_flurx_ipc/src/component.rs @@ -1,8 +1,8 @@ //! Defines a handler that executes the [`Action`](bevy_flurx::prelude::Action) of the command. use crate::ipc_commands::IpcCommand; +use bevy::platform::collections::HashMap; use bevy::prelude::{Commands, Component, Entity, Reflect, ReflectComponent, ReflectDeserialize, ReflectSerialize}; -use bevy::utils::HashMap; use serde::{Deserialize, Serialize}; /// The ipc invoke handlers. diff --git a/crates/bevy_flurx_ipc/src/ipc_events.rs b/crates/bevy_flurx_ipc/src/ipc_events.rs index 56355b2..b2294a2 100644 --- a/crates/bevy_flurx_ipc/src/ipc_events.rs +++ b/crates/bevy_flurx_ipc/src/ipc_events.rs @@ -1,7 +1,8 @@ //! Defines the ipc commands and the queue to execute them. -use bevy::prelude::{error, App, Entity, Event, EventWriter, IntoSystemConfigs, Plugin, PreUpdate, Res, Resource}; -use bevy::utils::HashMap; +use bevy::log::error; +use bevy::platform::collections::HashMap; +use bevy::prelude::{App, Entity, Event, EventWriter, IntoScheduleConfigs, Plugin, PreUpdate, Res, Resource}; use serde::de::DeserializeOwned; use serde::Deserialize; use std::sync::{Arc, Mutex}; @@ -127,7 +128,7 @@ fn send_ipc_events( ipc_events: Res>, ) { if let Ok(mut guard) = ipc_events.0.try_lock() { - ew.send_batch(std::mem::take(&mut *guard)); + ew.write_batch(std::mem::take(&mut *guard)); } } diff --git a/crates/bevy_flurx_ipc_macro/Cargo.toml b/crates/bevy_flurx_ipc_macro/Cargo.toml index 9d12d23..e87efb1 100644 --- a/crates/bevy_flurx_ipc_macro/Cargo.toml +++ b/crates/bevy_flurx_ipc_macro/Cargo.toml @@ -18,11 +18,11 @@ proc-macro2 = "1" syn = { version = "2", features = ["full", "extra-traits"] } quote = "1" darling = { version = "0.20" } -bevy = { version = "0.15", default-features = false, optional = true } +bevy = { workspace = true, default-features = false, optional = true } serde = { workspace = true, optional = true } [dev-dependencies] -bevy = { version = "0.15", default-features = false } +bevy = { version = "0.16.0-rc.3", default-features = false } bevy_flurx = { workspace = true } bevy_flurx_ipc = { path = "../bevy_flurx_ipc" } serde = { workspace = true } diff --git a/crates/bevy_webview_core/CHANGELOG.md b/crates/bevy_webview_core/CHANGELOG.md index 783be0b..c05dc70 100644 --- a/crates/bevy_webview_core/CHANGELOG.md +++ b/crates/bevy_webview_core/CHANGELOG.md @@ -1,5 +1,9 @@ ## Unreleased +## Features + +- Upgrade bevy's version to v0.16.0 + ## v0.2.0 [Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.2.0) diff --git a/crates/bevy_webview_core/src/bundle/embedding.rs b/crates/bevy_webview_core/src/bundle/embedding.rs index d8d2bf8..8d35bd9 100644 --- a/crates/bevy_webview_core/src/bundle/embedding.rs +++ b/crates/bevy_webview_core/src/bundle/embedding.rs @@ -29,7 +29,7 @@ mod grip_zone; /// ){ /// commands.spawn(( /// Webview::default(), -/// EmbedWithin(window.single()), +/// EmbedWithin(window.single().expect("Parent window not found")), /// )); /// } #[repr(transparent)] diff --git a/crates/bevy_webview_core/src/bundle/webview/webview_uri.rs b/crates/bevy_webview_core/src/bundle/webview/webview_uri.rs index 957a574..bd13e05 100644 --- a/crates/bevy_webview_core/src/bundle/webview/webview_uri.rs +++ b/crates/bevy_webview_core/src/bundle/webview/webview_uri.rs @@ -25,7 +25,7 @@ use std::path::{Path, PathBuf}; /// /// fn spawn_webview(mut commands: Commands, window: Query>){ /// commands -/// .entity(window.single()) +/// .entity(window.single().expect("Failed to obtain the window")) /// // The actual URL is flurx://localhost/ui/example.html. /// // show assets/ui/example.html /// .insert(Webview::Uri(WebviewUri::relative_local("example.html"))); diff --git a/crates/bevy_webview_wry/CHANGELOG.md b/crates/bevy_webview_wry/CHANGELOG.md index b6cd407..a3f3f0d 100644 --- a/crates/bevy_webview_wry/CHANGELOG.md +++ b/crates/bevy_webview_wry/CHANGELOG.md @@ -1,3 +1,9 @@ +## Unreleased + +## Features + +- Upgrade bevy's version to v0.16.0 + ## v0.3.0 [Release notes](https://github.com/not-elm/bevy_webview_projects/releases/tag/v0.3.0) diff --git a/crates/bevy_webview_wry/Cargo.toml b/crates/bevy_webview_wry/Cargo.toml index 1f2ad56..d59ea85 100644 --- a/crates/bevy_webview_wry/Cargo.toml +++ b/crates/bevy_webview_wry/Cargo.toml @@ -23,18 +23,18 @@ bevy = { workspace = true, features = [ "bevy_color", "serialize", ] } -bevy_flurx = { workspace = true } bevy_webview_core = { workspace = true } bevy_flurx_ipc = { workspace = true } bevy_flurx_api = { workspace = true, optional = true, features = ["full"] } serde = { workspace = true } serde_json = { workspace = true } rand = "0.9" -bevy_child_window = { version = "0.1", optional = true } +bevy_child_window = { version = "0.2", optional = true } +wry = { version = "0.51", features = ["transparent", "linux-body"] } [target.'cfg(any(target_os="ios", target_os="macos"))'.dependencies] -objc2 = { version = "0.5" } -objc2-app-kit = { version = "0.2.0", features = [ +objc2 = { version = "0.6" } +objc2-app-kit = { version = "0.3", features = [ "NSApplication", "NSEvent", "NSWindow", @@ -42,22 +42,14 @@ objc2-app-kit = { version = "0.2.0", features = [ "NSPanel", "NSResponder", ] } -objc2-foundation = { version = "0.2.0" } - -[dependencies.wry] -version = "0.48" -features = [ - "transparent", - "linux-body", -] +objc2-foundation = { version = "0.3" } [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies] gtk = { version = "0.18" } rfd = { version = "0.15", default-features = false, features = ["gtk3"] } [dev-dependencies] -bevy = "0.15.0" -bevy_flurx = { workspace = true } +bevy = "0.16" bevy_flurx_ipc = { path = "../bevy_flurx_ipc" } serde = { workspace = true } serde_json = { workspace = true } diff --git a/crates/bevy_webview_wry/src/embedding/grip_zone.rs b/crates/bevy_webview_wry/src/embedding/grip_zone.rs index a85c77c..65b3420 100644 --- a/crates/bevy_webview_wry/src/embedding/grip_zone.rs +++ b/crates/bevy_webview_wry/src/embedding/grip_zone.rs @@ -6,7 +6,7 @@ use bevy::ecs::system::SystemParam; use bevy::input::common_conditions::input_just_released; #[cfg(not(target_os = "linux"))] use bevy::input::mouse::MouseMotion; -use bevy::prelude::{any_with_component, on_event, App, Changed, Commands, Condition, Entity, EventReader, IntoSystemConfigs, MouseButton, NonSend, Plugin, Query, Update, Vec2, Window, With}; +use bevy::prelude::*; use bevy::winit::WinitWindows; use bevy_flurx_ipc::ipc_events::{IpcEvent, IpcEventExt}; use bevy_webview_core::bundle::embedding::{Bounds, EmbedWithin}; diff --git a/crates/bevy_webview_wry/src/embedding/resize.rs b/crates/bevy_webview_wry/src/embedding/resize.rs index 00ac3fb..07dd783 100644 --- a/crates/bevy_webview_wry/src/embedding/resize.rs +++ b/crates/bevy_webview_wry/src/embedding/resize.rs @@ -3,10 +3,7 @@ use crate::prelude::{WebviewInitialized, WryWebViews}; use crate::util::as_wry_rect; use bevy::input::common_conditions::input_pressed; use bevy::math::Vec2; -use bevy::prelude::{ - not, Added, App, Changed, Commands, Entity, IntoSystemConfigs, MouseButton, NonSend, Or, - Plugin, Query, Update, Without, -}; +use bevy::prelude::*; use bevy::window::Window; use bevy::winit::cursor::CursorIcon; use bevy_webview_core::prelude::*; diff --git a/crates/bevy_webview_wry/src/webview.rs b/crates/bevy_webview_wry/src/webview.rs index fcd18b0..6f4fda5 100644 --- a/crates/bevy_webview_wry/src/webview.rs +++ b/crates/bevy_webview_wry/src/webview.rs @@ -6,8 +6,8 @@ use crate::webview::ipc_resolve::IpcResolvePlugin; use crate::webview::load_webview::LoadWebviewPlugin; use crate::webview::protocol::CustomProtocolPlugin; use crate::webview::visible::VisiblePlugin; +use bevy::platform::collections::HashMap; use bevy::prelude::{App, Deref, DerefMut, Entity, Plugin}; -use bevy::utils::hashbrown::HashMap; use bevy_flurx_ipc::FlurxIpcPlugin; mod event_emitter; diff --git a/crates/bevy_webview_wry/src/webview/handlers.rs b/crates/bevy_webview_wry/src/webview/handlers.rs index 2513f51..621f629 100644 --- a/crates/bevy_webview_wry/src/webview/handlers.rs +++ b/crates/bevy_webview_wry/src/webview/handlers.rs @@ -330,5 +330,5 @@ fn convert_drag_drop_event( #[inline] fn send_wry_events(mut ew: EventWriter, events: Res>) { - ew.send_batch(events.take_events()); + ew.write_batch(events.take_events()); } diff --git a/crates/bevy_webview_wry/src/webview/handlers/dragdrop.rs b/crates/bevy_webview_wry/src/webview/handlers/dragdrop.rs index ec741b6..a90be1b 100644 --- a/crates/bevy_webview_wry/src/webview/handlers/dragdrop.rs +++ b/crates/bevy_webview_wry/src/webview/handlers/dragdrop.rs @@ -28,16 +28,16 @@ fn send_dragdrop_event( for event in events.take_events() { match event.event { DragDropEvent::Enter(enter) => { - entered.send(enter); + entered.write(enter); } DragDropEvent::Over(event) => { - over.send(event); + over.write(event); } DragDropEvent::Drop(event) => { - dropped.send(event); + dropped.write(event); } DragDropEvent::Leave(event) => { - leaved.send(event); + leaved.write(event); } } } diff --git a/crates/bevy_webview_wry/src/webview/handlers/new_window_request.rs b/crates/bevy_webview_wry/src/webview/handlers/new_window_request.rs index d06c4af..3ee4a35 100644 --- a/crates/bevy_webview_wry/src/webview/handlers/new_window_request.rs +++ b/crates/bevy_webview_wry/src/webview/handlers/new_window_request.rs @@ -52,7 +52,7 @@ fn open_new_window( )) .id(); - ew.send(NewWindowOpened { + ew.write(NewWindowOpened { webview_entity: request.webview_entity, opened_window_entity, url: request.url, diff --git a/crates/bevy_webview_wry/src/webview/load_webview.rs b/crates/bevy_webview_wry/src/webview/load_webview.rs index b4a4a42..6e4cdaa 100644 --- a/crates/bevy_webview_wry/src/webview/load_webview.rs +++ b/crates/bevy_webview_wry/src/webview/load_webview.rs @@ -28,7 +28,7 @@ impl Plugin for LoadWebviewPlugin { #[cfg(target_os = "macos")] { - use bevy::prelude::IntoSystemConfigs; + use bevy::prelude::IntoScheduleConfigs; app.add_systems(PreUpdate, ( resize_webview_inner_window.run_if(bevy::prelude::on_event::), )); @@ -174,7 +174,7 @@ fn feed_configs2<'a>( let mut builder = builder .with_focused(focused.0) .with_hotkeys_zoom(hotkeys_zoom.0) - .with_initialization_script(&initialization_script(initialization_scripts, &identifier, is_embedded)); + .with_initialization_script(initialization_script(initialization_scripts, &identifier, is_embedded)); if let Some(user_agent) = user_agent.0.as_ref() { builder = builder.with_user_agent(user_agent); } @@ -263,8 +263,8 @@ unsafe fn attach_inner_window( webview.removeFromSuperview(); webview.setAutoresizingMask( - NSAutoresizingMaskOptions::NSViewHeightSizable | - NSAutoresizingMaskOptions::NSViewWidthSizable, + NSAutoresizingMaskOptions::ViewHeightSizable | + NSAutoresizingMaskOptions::ViewWidthSizable, ); let mtw = objc2_foundation::MainThreadMarker::new().unwrap(); @@ -285,14 +285,14 @@ unsafe fn attach_inner_window( inner_window.setFrame_display(content_rect, true); inner_window.setHidesOnDeactivate(false); inner_window.setTitlebarAppearsTransparent(true); - inner_window.setTitleVisibility(objc2_app_kit::NSWindowTitleVisibility::NSWindowTitleHidden); + inner_window.setTitleVisibility(objc2_app_kit::NSWindowTitleVisibility::Hidden); inner_window.setContentView(Some(webview)); inner_window.becomeKeyWindow(); inner_window.makeFirstResponder(Some(webview)); - application_window.addChildWindow_ordered(&inner_window, objc2_app_kit::NSWindowOrderingMode::NSWindowAbove); + application_window.addChildWindow_ordered(&inner_window, objc2_app_kit::NSWindowOrderingMode::Above); application_window.makeFirstResponder(Some(&inner_window)); inner_window.makeKeyAndOrderFront(None); @@ -331,7 +331,7 @@ fn resize_webview_inner_window( // that the `AppKitWindowHandle` contains a valid pointer to an // `NSView`. // Unwrap is fine, since the pointer came from `NonNull`. - let ns_view: objc2::rc::Id = unsafe { objc2::rc::Id::retain(ns_view.cast()) }.unwrap(); + let ns_view: objc2::rc::Retained = unsafe { objc2::rc::Retained::retain(ns_view.cast()) }.unwrap(); let Some(ns_window) = ns_view.window() else { continue; }; diff --git a/crates/bevy_webview_wry/src/webview/protocol.rs b/crates/bevy_webview_wry/src/webview/protocol.rs index 640d5c7..f90d48c 100644 --- a/crates/bevy_webview_wry/src/webview/protocol.rs +++ b/crates/bevy_webview_wry/src/webview/protocol.rs @@ -2,8 +2,8 @@ mod asset; use crate::webview::protocol::asset::{convert_to_response, WryRequestArgs, WryResponseBody, WryResponseHandle, WryResponseLoader}; use bevy::app::{App, Plugin}; +use bevy::platform::collections::hash_map::HashMap; use bevy::prelude::*; -use bevy::utils::HashMap; use bevy_webview_core::prelude::Csp; use std::path::PathBuf; use std::sync::mpsc::{Receiver, Sender}; diff --git a/crates/bevy_webview_wry/src/webview/protocol/asset.rs b/crates/bevy_webview_wry/src/webview/protocol/asset.rs index 3d08ca7..92dcaf9 100644 --- a/crates/bevy_webview_wry/src/webview/protocol/asset.rs +++ b/crates/bevy_webview_wry/src/webview/protocol/asset.rs @@ -69,7 +69,7 @@ fn try_convert_to_response( response_builder .header(CONTENT_TYPE, mimetype) .body(content) - .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)) + .map_err(std::io::Error::other) } struct NotImplError(PathBuf); diff --git a/examples/wry/child_window.rs b/examples/wry/child_window.rs index e210fc3..8a884c2 100644 --- a/examples/wry/child_window.rs +++ b/examples/wry/child_window.rs @@ -26,7 +26,7 @@ fn spawn_child_window( ..default() }, Webview::Uri(WebviewUri::new("https://bevyengine.org/")), - ParentWindow(window.single()), + ParentWindow(window.single().expect("Parent window not found")), )); } diff --git a/examples/wry/embedding.rs b/examples/wry/embedding.rs index e07e92c..953e03f 100644 --- a/examples/wry/embedding.rs +++ b/examples/wry/embedding.rs @@ -38,7 +38,7 @@ fn spawn_webview( commands.spawn(( Webview::Uri(WebviewUri::default()), // Specifies the window entity to embed. - EmbedWithin(window.single()), + EmbedWithin(window.single().expect("Parent window not found")), Resizable(true), // Grab the top of the webview and allow it to move. GripZone(10), @@ -51,7 +51,7 @@ fn spawn_webview( commands.spawn(( Webview::Uri(WebviewUri::new("https://bevyengine.org/")), - EmbedWithin(window.single()), + EmbedWithin(window.single().expect("Parent window not found")), Bounds { position: Vec2::new(700., 100.), size: Vec2::new(500., 500.), diff --git a/examples/wry/embedding_html.rs b/examples/wry/embedding_html.rs index 4c3d7e8..673f4a1 100644 --- a/examples/wry/embedding_html.rs +++ b/examples/wry/embedding_html.rs @@ -20,7 +20,7 @@ fn insert_webview( window: Query>, ) { commands - .entity(window.single()) + .entity(window.single().expect("Parent window not found")) .insert(Webview::Html("

Hello world!

".to_string())); } diff --git a/examples/wry/event_emit.rs b/examples/wry/event_emit.rs index 9768a77..b768d29 100644 --- a/examples/wry/event_emit.rs +++ b/examples/wry/event_emit.rs @@ -30,7 +30,7 @@ fn spawn_webview( window: Query>, ) { // Display `assets/ui/event_emit/index.html` within the webview. - commands.entity(window.single()).insert(Webview::default()); + commands.entity(window.single().expect("Window wasn't found")).insert(Webview::default()); } fn emit_event( diff --git a/examples/wry/event_listen.rs b/examples/wry/event_listen.rs index d9a28d9..47feebe 100644 --- a/examples/wry/event_listen.rs +++ b/examples/wry/event_listen.rs @@ -27,7 +27,7 @@ fn spawn_webview( mut commands: Commands, window: Query>, ) { - commands.entity(window.single()).insert(Webview::default()); + commands.entity(window.single().expect("Window wasn't found")).insert(Webview::default()); } #[derive(Deserialize, Debug)] diff --git a/examples/wry/ipc_command.rs b/examples/wry/ipc_command.rs index 0cc4f7a..8c9f63e 100644 --- a/examples/wry/ipc_command.rs +++ b/examples/wry/ipc_command.rs @@ -28,7 +28,7 @@ fn spawn_webview( mut commands: Commands, window: Query>, ) { - commands.entity(window.single()).insert(( + commands.entity(window.single().expect("Parent window was not found")).insert(( Num(1), // Display `assets/ui/ipc_command/index.html` within the webview Webview::default(), diff --git a/examples/wry/simple.rs b/examples/wry/simple.rs index deefc82..afcb875 100644 --- a/examples/wry/simple.rs +++ b/examples/wry/simple.rs @@ -20,7 +20,7 @@ fn spawn_webview( ) { // Converts the `Window` attached the entity into a webview window. commands - .entity(window.single()) + .entity(window.single().expect("Parent window not found")) .insert(Webview::Uri(WebviewUri::new("https://bevyengine.org/"))); }