fix(windows): gate with_webview call to Windows only
Build Lotus Chat Desktop / build-linux (push) Failing after 13m50s
Build Lotus Chat Desktop / build-windows (push) Failing after 23m55s
Build Lotus Chat Desktop / update-manifest (push) Has been skipped

with_webview is not available on Linux; break the builder chain and apply
it conditionally so the Linux build compiles without the wry feature flag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 21:51:56 -04:00
parent efcc11771e
commit 443c85c9b5
+7 -9
View File
@@ -63,16 +63,16 @@ pub fn run() {
}; };
let app_handle = app.handle().clone(); let app_handle = app.handle().clone();
WebviewWindowBuilder::new(app, "main".to_string(), window_url) let builder = WebviewWindowBuilder::new(app, "main".to_string(), window_url)
.title("Cinny") .title("Cinny")
.disable_drag_drop_handler() .disable_drag_drop_handler()
.on_new_window(move |url, _features| { .on_new_window(move |url, _features| {
let _ = app_handle.opener().open_url(url.as_str(), None::<&str>); let _ = app_handle.opener().open_url(url.as_str(), None::<&str>);
NewWindowResponse::Deny NewWindowResponse::Deny
}) });
.with_webview(|webview| {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ let builder = builder.with_webview(|webview| {
use webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2PermissionRequestedEventHandler; use webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2PermissionRequestedEventHandler;
use windows::core::EventRegistrationToken; use windows::core::EventRegistrationToken;
use win_permissions::PermissionHandler; use win_permissions::PermissionHandler;
@@ -81,15 +81,13 @@ pub fn run() {
if let Ok(core) = unsafe { controller.CoreWebView2() } { if let Ok(core) = unsafe { controller.CoreWebView2() } {
let handler: ICoreWebView2PermissionRequestedEventHandler = let handler: ICoreWebView2PermissionRequestedEventHandler =
PermissionHandler.into(); PermissionHandler.into();
// Register the handler; token is unused since we never unregister.
// If this fails to compile, try: unsafe { core.add_PermissionRequested(&handler) }
let mut token = EventRegistrationToken(0); let mut token = EventRegistrationToken(0);
let _ = unsafe { core.add_PermissionRequested(&handler, &mut token) }; let _ = unsafe { core.add_PermissionRequested(&handler, &mut token) };
std::mem::forget(handler); std::mem::forget(handler);
} }
} });
})
.build()?; builder.build()?;
Ok(()) Ok(())
}) })
.run(context) .run(context)