Skip to content

Commit 7c7d854

Browse files
authored
refactor(core): remove deprecated APIs (#3834)
1 parent 6a5ff08 commit 7c7d854

3 files changed

Lines changed: 8 additions & 110 deletions

File tree

.changes/remove-depracated.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
**Breaking change:** Removed `App::create_window`, `AppHandle::create_window`, `Builder::create_window` and `Window::create_window`.

core/tauri/src/app.rs

Lines changed: 3 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ use crate::{
1515
plugin::{Plugin, PluginStore},
1616
runtime::{
1717
http::{Request as HttpRequest, Response as HttpResponse},
18-
webview::{WebviewAttributes, WindowBuilder as _},
18+
webview::WebviewAttributes,
1919
window::{PendingWindow, WindowEvent as RuntimeWindowEvent},
20-
Dispatch, ExitRequestedEventAction, RunEvent as RuntimeRunEvent,
20+
ExitRequestedEventAction, RunEvent as RuntimeRunEvent,
2121
},
2222
scope::FsScope,
2323
sealed::{ManagerBase, RuntimeOrDispatch},
24-
utils::config::{Config, WindowUrl},
24+
utils::config::Config,
2525
utils::{assets::Assets, Env},
26-
window::WindowBuilder,
2726
Context, EventLoopMessage, Invoke, InvokeError, InvokeResponse, Manager, Runtime, Scopes,
2827
StateManager, Window,
2928
};
@@ -481,38 +480,6 @@ macro_rules! shared_app_impl {
481480
updater::builder(self.app_handle())
482481
}
483482

484-
/// Creates a new webview window.
485-
///
486-
/// Data URLs are only supported with the `window-data-url` feature flag.
487-
///
488-
/// See [`crate::window::WindowBuilder::new`] for an API with extended functionality.
489-
#[deprecated(
490-
since = "1.0.0-rc.4",
491-
note = "The `window_builder` function offers an easier API with extended functionality"
492-
)]
493-
pub fn create_window<F>(
494-
&self,
495-
label: impl Into<String>,
496-
url: WindowUrl,
497-
setup: F,
498-
) -> crate::Result<Window<R>>
499-
where
500-
F: FnOnce(
501-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
502-
WebviewAttributes,
503-
) -> (
504-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
505-
WebviewAttributes,
506-
),
507-
{
508-
let mut builder = WindowBuilder::<R>::new(self, label, url);
509-
let (window_builder, webview_attributes) =
510-
setup(builder.window_builder, builder.webview_attributes);
511-
builder.window_builder = window_builder;
512-
builder.webview_attributes = webview_attributes;
513-
builder.build()
514-
}
515-
516483
#[cfg(feature = "system-tray")]
517484
#[cfg_attr(doc_cfg, doc(cfg(feature = "system-tray")))]
518485
/// Gets a handle handle to the system tray.
@@ -979,48 +946,6 @@ impl<R: Runtime> Builder<R> {
979946
self
980947
}
981948

982-
/// Creates a new webview window.
983-
///
984-
/// # Examples
985-
/// ```rust,no_run
986-
/// use tauri::WindowBuilder;
987-
/// tauri::Builder::default()
988-
/// .create_window("main", tauri::WindowUrl::default(), |win, webview| {
989-
/// let win = win
990-
/// .title("My Main Window")
991-
/// .resizable(true)
992-
/// .inner_size(800.0, 550.0)
993-
/// .min_inner_size(400.0, 200.0);
994-
/// return (win, webview);
995-
/// });
996-
/// ```
997-
pub fn create_window<F>(
998-
mut self,
999-
label: impl Into<String>,
1000-
url: WindowUrl,
1001-
setup: F,
1002-
) -> crate::Result<Self>
1003-
where
1004-
F: FnOnce(
1005-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
1006-
WebviewAttributes,
1007-
) -> (
1008-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
1009-
WebviewAttributes,
1010-
),
1011-
{
1012-
let (window_builder, webview_attributes) = setup(
1013-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder::new(),
1014-
WebviewAttributes::new(url),
1015-
);
1016-
self.pending_windows.push(PendingWindow::new(
1017-
window_builder,
1018-
webview_attributes,
1019-
label,
1020-
)?);
1021-
Ok(self)
1022-
}
1023-
1024949
/// Adds the icon configured on `tauri.conf.json` to the system tray with the specified menu items.
1025950
#[cfg(feature = "system-tray")]
1026951
#[cfg_attr(doc_cfg, doc(cfg(feature = "system-tray")))]

core/tauri/src/window.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -557,38 +557,6 @@ impl<R: Runtime> Window<R> {
557557
WindowBuilder::<R>::new(manager, label.into(), url)
558558
}
559559

560-
/// Creates a new webview window.
561-
///
562-
/// Data URLs are only supported with the `window-data-url` feature flag.
563-
///
564-
/// See [`Self::builder`] for an API with extended functionality.
565-
#[deprecated(
566-
since = "1.0.0-rc.4",
567-
note = "The `builder` function offers an easier API with extended functionality"
568-
)]
569-
pub fn create_window<F>(
570-
&mut self,
571-
label: String,
572-
url: WindowUrl,
573-
setup: F,
574-
) -> crate::Result<Window<R>>
575-
where
576-
F: FnOnce(
577-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
578-
WebviewAttributes,
579-
) -> (
580-
<R::Dispatcher as Dispatch<EventLoopMessage>>::WindowBuilder,
581-
WebviewAttributes,
582-
),
583-
{
584-
let mut builder = WindowBuilder::<R>::new(self, label, url);
585-
let (window_builder, webview_attributes) =
586-
setup(builder.window_builder, builder.webview_attributes);
587-
builder.window_builder = window_builder;
588-
builder.webview_attributes = webview_attributes;
589-
builder.build()
590-
}
591-
592560
pub(crate) fn invoke_responder(&self) -> Arc<InvokeResponder<R>> {
593561
self.manager.invoke_responder()
594562
}

0 commit comments

Comments
 (0)