fix(core): prepare window icon and menu on remote URLs, closes #4131 (#4140)

This commit is contained in:
Lucas Fernandes Nogueira 2022-05-16 06:19:11 -07:00 committed by GitHub
parent 3e702cf8b1
commit 25aa4347b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 14 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch
---
Prepare window icon and menu even when loading remote URLs. Previously it was behind a `is local URL?` condition.

View File

@ -458,20 +458,6 @@ impl<R: Runtime> WindowManager<R> {
pending.webview_attributes = webview_attributes;
if !pending.window_builder.has_icon() {
if let Some(default_window_icon) = self.inner.default_window_icon.clone() {
pending.window_builder = pending
.window_builder
.icon(default_window_icon.try_into()?)?;
}
}
if pending.window_builder.get_menu().is_none() {
if let Some(menu) = &self.inner.menu {
pending = pending.set_menu(menu.clone());
}
}
let mut registered_scheme_protocols = Vec::new();
for (uri_scheme, protocol) in &self.inner.uri_scheme_protocols {
@ -1118,6 +1104,20 @@ impl<R: Runtime> WindowManager<R> {
pending.url = url.to_string();
if !pending.window_builder.has_icon() {
if let Some(default_window_icon) = self.inner.default_window_icon.clone() {
pending.window_builder = pending
.window_builder
.icon(default_window_icon.try_into()?)?;
}
}
if pending.window_builder.get_menu().is_none() {
if let Some(menu) = &self.inner.menu {
pending = pending.set_menu(menu.clone());
}
}
if is_local {
let label = pending.label.clone();
pending = self.prepare_pending_window(