mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-01-31 00:35:19 +01:00
fix: a few regressions from previous PRs (#14020)
* fix: a few regressions from previous PRs * rename with_window_features to window_features * Clippy * clippy --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
@@ -1715,7 +1715,7 @@ impl<T: UserEvent> WebviewDispatch<T> for WryWebviewDispatcher<T> {
|
||||
Message::Webview(
|
||||
*self.window_id.lock().unwrap(),
|
||||
self.webview_id,
|
||||
WebviewMessage::DeleteCookie(cookie.clone().into_owned()),
|
||||
WebviewMessage::DeleteCookie(cookie.into_owned()),
|
||||
),
|
||||
)?;
|
||||
Ok(())
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
pub(crate) mod plugin;
|
||||
mod webview_window;
|
||||
|
||||
use cookie::Cookie;
|
||||
pub use webview_window::{WebviewWindow, WebviewWindowBuilder};
|
||||
|
||||
/// Cookie crate used for [`Webview::set_cookie`] and [`Webview::delete_cookie`].
|
||||
@@ -20,6 +19,8 @@ use http::HeaderMap;
|
||||
use serde::Serialize;
|
||||
use tauri_macros::default_runtime;
|
||||
pub use tauri_runtime::webview::{NewWindowFeatures, PageLoadEvent};
|
||||
// Remove this re-export in v3
|
||||
pub use tauri_runtime::Cookie;
|
||||
#[cfg(desktop)]
|
||||
use tauri_runtime::{
|
||||
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
|
||||
@@ -521,7 +522,7 @@ tauri::Builder::default()
|
||||
"opened-window",
|
||||
tauri::WebviewUrl::External("about:blank".parse().unwrap()),
|
||||
)
|
||||
.with_window_features(features)
|
||||
.window_features(features)
|
||||
.on_document_title_changed(|window, title| {
|
||||
window.set_title(&title).unwrap();
|
||||
})
|
||||
|
||||
@@ -297,7 +297,7 @@ impl<'a, R: Runtime, M: Manager<R>> WebviewWindowBuilder<'a, R, M> {
|
||||
/// "opened-window",
|
||||
/// tauri::WebviewUrl::External("about:blank".parse().unwrap()),
|
||||
/// )
|
||||
/// .with_window_features(features)
|
||||
/// .window_features(features)
|
||||
/// .on_document_title_changed(|window, title| {
|
||||
/// window.set_title(&title).unwrap();
|
||||
/// })
|
||||
@@ -1312,7 +1312,7 @@ impl<R: Runtime, M: Manager<R>> WebviewWindowBuilder<'_, R, M> {
|
||||
target_os = "netbsd",
|
||||
target_os = "openbsd"
|
||||
))]
|
||||
pub fn with_window_features(mut self, features: NewWindowFeatures) -> Self {
|
||||
pub fn window_features(mut self, features: NewWindowFeatures) -> Self {
|
||||
if let Some(position) = features.position() {
|
||||
self.window_builder = self.window_builder.position(position.x, position.y);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ mod menu_plugin;
|
||||
#[cfg(desktop)]
|
||||
mod tray;
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
|
||||
use serde::Serialize;
|
||||
use tauri::{
|
||||
ipc::Channel,
|
||||
@@ -68,40 +66,40 @@ pub fn run_app<R: Runtime, F: FnOnce(&App<R>) + Send + 'static>(
|
||||
.build()?,
|
||||
));
|
||||
|
||||
let app_ = app.handle().clone();
|
||||
|
||||
let mut created_window_count = AtomicUsize::new(0);
|
||||
let mut window_builder = WebviewWindowBuilder::new(app, "main", WebviewUrl::default())
|
||||
.on_new_window(move |url, features| {
|
||||
println!("new window requested: {url:?} {features:?}");
|
||||
|
||||
let number = created_window_count.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
let builder = tauri::WebviewWindowBuilder::new(
|
||||
&app_,
|
||||
format!("new-{number}"),
|
||||
tauri::WebviewUrl::External("about:blank".parse().unwrap()),
|
||||
)
|
||||
.with_window_features(features)
|
||||
.on_document_title_changed(|window, title| {
|
||||
window.set_title(&title).unwrap();
|
||||
})
|
||||
.title(url.as_str());
|
||||
|
||||
let window = builder.build().unwrap();
|
||||
tauri::webview::NewWindowResponse::Create { window }
|
||||
})
|
||||
.on_document_title_changed(|_window, title| {
|
||||
println!("document title changed: {title}");
|
||||
});
|
||||
|
||||
#[cfg(all(desktop, not(test)))]
|
||||
{
|
||||
let app_ = app.handle().clone();
|
||||
let mut created_window_count = std::sync::atomic::AtomicUsize::new(0);
|
||||
|
||||
window_builder = window_builder
|
||||
.title("Tauri API Validation")
|
||||
.inner_size(1000., 800.)
|
||||
.min_inner_size(600., 400.)
|
||||
.menu(tauri::menu::Menu::default(app.handle())?);
|
||||
.menu(tauri::menu::Menu::default(app.handle())?)
|
||||
.on_new_window(move |url, features| {
|
||||
println!("new window requested: {url:?} {features:?}");
|
||||
|
||||
let number = created_window_count.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
let builder = tauri::WebviewWindowBuilder::new(
|
||||
&app_,
|
||||
format!("new-{number}"),
|
||||
tauri::WebviewUrl::External("about:blank".parse().unwrap()),
|
||||
)
|
||||
.window_features(features)
|
||||
.on_document_title_changed(|window, title| {
|
||||
window.set_title(&title).unwrap();
|
||||
})
|
||||
.title(url.as_str());
|
||||
|
||||
let window = builder.build().unwrap();
|
||||
tauri::webview::NewWindowResponse::Create { window }
|
||||
});
|
||||
}
|
||||
|
||||
let webview = window_builder.build()?;
|
||||
|
||||
Reference in New Issue
Block a user