浏览代码

refactor(core): move dialog API to its own plugin (#6717)

Lucas Fernandes Nogueira 2 年之前
父节点
当前提交
2d5378bfc1

+ 5 - 0
.changes/bundler-remove-dialog-option.md

@@ -0,0 +1,5 @@
+---
+"tauri-bundler": patch
+---
+
+Removed the `UpdaterSettings::dialog` field.

+ 6 - 0
.changes/move-dialog-plugin.md

@@ -0,0 +1,6 @@
+---
+"tauri": patch
+"api": patch
+---
+
+Moved the dialog APIs to its own plugin in the plugins-workspace repository.

+ 6 - 0
.changes/remove-updater-dialog.md

@@ -0,0 +1,6 @@
+---
+"tauri": patch
+"tauri-utils": patch
+---
+
+Remove the updater's dialog option.

+ 0 - 7
core/config-schema/schema.json

@@ -172,7 +172,6 @@
         },
         "updater": {
           "active": false,
-          "dialog": true,
           "pubkey": "",
           "windows": {
             "installMode": "passive",
@@ -426,7 +425,6 @@
           "description": "The updater configuration.",
           "default": {
             "active": false,
-            "dialog": true,
             "pubkey": "",
             "windows": {
               "installMode": "passive",
@@ -2476,11 +2474,6 @@
           "default": false,
           "type": "boolean"
         },
-        "dialog": {
-          "description": "Display built-in dialog or use event system if disabled.",
-          "default": true,
-          "type": "boolean"
-        },
         "endpoints": {
           "description": "The updater endpoints. TLS is enforced on production.\n\nThe updater URL can contain the following variables: - {{current_version}}: The version of the app that is requesting the update - {{target}}: The operating system name (one of `linux`, `windows` or `darwin`). - {{arch}}: The architecture of the machine (one of `x86_64`, `i686`, `aarch64` or `armv7`).\n\n# Examples - \"https://my.cdn.com/latest.json\": a raw JSON endpoint that returns the latest version and download links for each platform. - \"https://updates.app.dev/{{target}}?version={{current_version}}&arch={{arch}}\": a dedicated API with positional and query string arguments.",
           "type": [

+ 1 - 18
core/tauri-utils/src/config.rs

@@ -2335,9 +2335,6 @@ pub struct UpdaterConfig {
   /// Whether the updater is active or not.
   #[serde(default)]
   pub active: bool,
-  /// Display built-in dialog or use event system if disabled.
-  #[serde(default = "default_true")]
-  pub dialog: bool,
   /// The updater endpoints. TLS is enforced on production.
   ///
   /// The updater URL can contain the following variables:
@@ -2367,8 +2364,6 @@ impl<'de> Deserialize<'de> for UpdaterConfig {
     struct InnerUpdaterConfig {
       #[serde(default)]
       active: bool,
-      #[serde(default = "default_true")]
-      dialog: bool,
       endpoints: Option<Vec<UpdaterEndpoint>>,
       pubkey: Option<String>,
       #[serde(default)]
@@ -2385,7 +2380,6 @@ impl<'de> Deserialize<'de> for UpdaterConfig {
 
     Ok(UpdaterConfig {
       active: config.active,
-      dialog: config.dialog,
       endpoints: config.endpoints,
       pubkey: config.pubkey.unwrap_or_default(),
       windows: config.windows,
@@ -2397,7 +2391,6 @@ impl Default for UpdaterConfig {
   fn default() -> Self {
     Self {
       active: false,
-      dialog: default_true(),
       endpoints: None,
       pubkey: "".into(),
       windows: Default::default(),
@@ -3246,7 +3239,6 @@ mod build {
   impl ToTokens for UpdaterConfig {
     fn to_tokens(&self, tokens: &mut TokenStream) {
       let active = self.active;
-      let dialog = self.dialog;
       let pubkey = str_lit(&self.pubkey);
       let endpoints = opt_lit(
         self
@@ -3262,15 +3254,7 @@ mod build {
       );
       let windows = &self.windows;
 
-      literal_struct!(
-        tokens,
-        UpdaterConfig,
-        active,
-        dialog,
-        pubkey,
-        endpoints,
-        windows
-      );
+      literal_struct!(tokens, UpdaterConfig, active, pubkey, endpoints, windows);
     }
   }
 
@@ -3596,7 +3580,6 @@ mod test {
       },
       updater: UpdaterConfig {
         active: false,
-        dialog: true,
         pubkey: "".into(),
         endpoints: None,
         windows: Default::default(),

+ 5 - 7
core/tauri/Cargo.toml

@@ -82,7 +82,6 @@ ico = { version = "0.2.0", optional = true }
 encoding_rs = "0.8.31"
 
 [target."cfg(any(target_os = \"macos\", windows, target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
-rfd = { version = "0.11", optional = true, features = [ "gtk3", "common-controls-v6" ] }
 notify-rust = { version = "4.5", optional = true }
 
 [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies]
@@ -157,7 +156,6 @@ native-tls = [ "reqwest/native-tls" ]
 native-tls-vendored = [ "reqwest/native-tls-vendored" ]
 rustls-tls = [ "reqwest/rustls-tls" ]
 process-command-api = [ "shared_child", "os_pipe" ]
-dialog = [ "rfd" ]
 notification = [ "notify-rust" ]
 system-tray = [ "tauri-runtime/system-tray", "tauri-runtime-wry/system-tray" ]
 devtools = [ "tauri-runtime/devtools", "tauri-runtime-wry/devtools" ]
@@ -187,11 +185,11 @@ clipboard-all = [ "clipboard-write-text", "clipboard-read-text" ]
 clipboard-read-text = [ ]
 clipboard-write-text = [ ]
 dialog-all = [ "dialog-open", "dialog-save", "dialog-message", "dialog-ask" ]
-dialog-ask = [ "dialog" ]
-dialog-confirm = [ "dialog" ]
-dialog-message = [ "dialog" ]
-dialog-open = [ "dialog" ]
-dialog-save = [ "dialog" ]
+dialog-ask = [ ]
+dialog-confirm = [ ]
+dialog-message = [ ]
+dialog-open = [ ]
+dialog-save = [ ]
 fs-all = [
   "fs-copy-file",
   "fs-create-dir",

文件差异内容过多而无法显示
+ 0 - 0
core/tauri/scripts/bundle.global.js


+ 0 - 733
core/tauri/src/api/dialog.rs

@@ -1,733 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-//! Use native message and file open/save dialogs.
-//!
-//! This module exposes non-blocking APIs on its root, relying on callback closures
-//! to give results back. This is particularly useful when running dialogs from the main thread.
-//! When using on asynchronous contexts such as async commands, the [`blocking`] APIs are recommended.
-
-pub use nonblocking::*;
-
-#[cfg(not(target_os = "linux"))]
-macro_rules! run_dialog {
-  ($e:expr, $h: ident) => {{
-    std::thread::spawn(move || {
-      let response = $e;
-      $h(response);
-    });
-  }};
-}
-
-#[cfg(target_os = "linux")]
-macro_rules! run_dialog {
-  ($e:expr, $h: ident) => {{
-    std::thread::spawn(move || {
-      let context = glib::MainContext::default();
-      context.invoke_with_priority(glib::PRIORITY_HIGH, move || {
-        let response = $e;
-        $h(response);
-      });
-    });
-  }};
-}
-
-#[cfg(not(target_os = "linux"))]
-macro_rules! run_file_dialog {
-  ($e:expr, $h: ident) => {{
-    std::thread::spawn(move || {
-      let response = crate::async_runtime::block_on($e);
-      $h(response);
-    });
-  }};
-}
-
-#[cfg(target_os = "linux")]
-macro_rules! run_file_dialog {
-  ($e:expr, $h: ident) => {{
-    std::thread::spawn(move || {
-      let context = glib::MainContext::default();
-      context.invoke_with_priority(glib::PRIORITY_HIGH, move || {
-        let response = $e;
-        $h(response);
-      });
-    });
-  }};
-}
-
-macro_rules! run_dialog_sync {
-  ($e:expr) => {{
-    let (tx, rx) = sync_channel(0);
-    let cb = move |response| {
-      tx.send(response).unwrap();
-    };
-    run_file_dialog!($e, cb);
-    rx.recv().unwrap()
-  }};
-}
-
-macro_rules! file_dialog_builder {
-  () => {
-    #[cfg(target_os = "linux")]
-    type FileDialog = rfd::FileDialog;
-    #[cfg(not(target_os = "linux"))]
-    type FileDialog = rfd::AsyncFileDialog;
-
-    /// The file dialog builder.
-    ///
-    /// Constructs file picker dialogs that can select single/multiple files or directories.
-    #[derive(Debug, Default)]
-    pub struct FileDialogBuilder(FileDialog);
-
-    impl FileDialogBuilder {
-      /// Gets the default file dialog builder.
-      pub fn new() -> Self {
-        Default::default()
-      }
-
-      /// Add file extension filter. Takes in the name of the filter, and list of extensions
-      #[must_use]
-      pub fn add_filter(mut self, name: impl AsRef<str>, extensions: &[&str]) -> Self {
-        self.0 = self.0.add_filter(name.as_ref(), extensions);
-        self
-      }
-
-      /// Set starting directory of the dialog.
-      #[must_use]
-      pub fn set_directory<P: AsRef<Path>>(mut self, directory: P) -> Self {
-        self.0 = self.0.set_directory(directory);
-        self
-      }
-
-      /// Set starting file name of the dialog.
-      #[must_use]
-      pub fn set_file_name(mut self, file_name: &str) -> Self {
-        self.0 = self.0.set_file_name(file_name);
-        self
-      }
-
-      /// Sets the parent window of the dialog.
-      #[must_use]
-      pub fn set_parent<W: raw_window_handle::HasRawWindowHandle>(mut self, parent: &W) -> Self {
-        self.0 = self.0.set_parent(parent);
-        self
-      }
-
-      /// Set the title of the dialog.
-      #[must_use]
-      pub fn set_title(mut self, title: &str) -> Self {
-        self.0 = self.0.set_title(title);
-        self
-      }
-    }
-  };
-}
-
-macro_rules! message_dialog_builder {
-  () => {
-    /// A builder for message dialogs.
-    pub struct MessageDialogBuilder(rfd::MessageDialog);
-
-    impl MessageDialogBuilder {
-      /// Creates a new message dialog builder.
-      pub fn new(title: impl AsRef<str>, message: impl AsRef<str>) -> Self {
-        let title = title.as_ref().to_string();
-        let message = message.as_ref().to_string();
-        Self(
-          rfd::MessageDialog::new()
-            .set_title(&title)
-            .set_description(&message),
-        )
-      }
-
-      /// Set parent windows explicitly (optional)
-      ///
-      /// ## Platform-specific
-      ///
-      /// - **Linux:** Unsupported.
-      pub fn parent<W: raw_window_handle::HasRawWindowHandle>(mut self, parent: &W) -> Self {
-        self.0 = self.0.set_parent(parent);
-        self
-      }
-
-      /// Set the set of button that will be displayed on the dialog.
-      pub fn buttons(mut self, buttons: MessageDialogButtons) -> Self {
-        self.0 = self.0.set_buttons(buttons.into());
-        self
-      }
-
-      /// Set type of a dialog.
-      ///
-      /// Depending on the system it can result in type specific icon to show up,
-      /// the will inform user it message is a error, warning or just information.
-      pub fn kind(mut self, kind: MessageDialogKind) -> Self {
-        self.0 = self.0.set_level(kind.into());
-        self
-      }
-    }
-  };
-}
-
-/// Options for action buttons on message dialogs.
-#[non_exhaustive]
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
-pub enum MessageDialogButtons {
-  /// Ok button.
-  Ok,
-  /// Ok and Cancel buttons.
-  OkCancel,
-  /// Yes and No buttons.
-  YesNo,
-  /// OK button with customized text.
-  OkWithLabel(String),
-  /// Ok and Cancel buttons with customized text.
-  OkCancelWithLabels(String, String),
-}
-
-impl From<MessageDialogButtons> for rfd::MessageButtons {
-  fn from(kind: MessageDialogButtons) -> Self {
-    match kind {
-      MessageDialogButtons::Ok => Self::Ok,
-      MessageDialogButtons::OkCancel => Self::OkCancel,
-      MessageDialogButtons::YesNo => Self::YesNo,
-      MessageDialogButtons::OkWithLabel(ok_text) => Self::OkCustom(ok_text),
-      MessageDialogButtons::OkCancelWithLabels(ok_text, cancel_text) => {
-        Self::OkCancelCustom(ok_text, cancel_text)
-      }
-    }
-  }
-}
-
-/// Types of message, ask and confirm dialogs.
-#[non_exhaustive]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum MessageDialogKind {
-  /// Information dialog.
-  Info,
-  /// Warning dialog.
-  Warning,
-  /// Error dialog.
-  Error,
-}
-
-impl From<MessageDialogKind> for rfd::MessageLevel {
-  fn from(kind: MessageDialogKind) -> Self {
-    match kind {
-      MessageDialogKind::Info => Self::Info,
-      MessageDialogKind::Warning => Self::Warning,
-      MessageDialogKind::Error => Self::Error,
-    }
-  }
-}
-
-/// Blocking interfaces for the dialog APIs.
-///
-/// The blocking APIs will block the current thread to execute instead of relying on callback closures,
-/// which makes them easier to use.
-///
-/// **NOTE:** You cannot block the main thread when executing the dialog APIs, so you must use the [`crate::api::dialog`] methods instead.
-/// Examples of main thread context are the [`crate::App::run`] closure and non-async commands.
-pub mod blocking {
-  use super::{MessageDialogButtons, MessageDialogKind};
-  use crate::{Runtime, Window};
-  use std::path::{Path, PathBuf};
-  use std::sync::mpsc::sync_channel;
-
-  file_dialog_builder!();
-  message_dialog_builder!();
-
-  impl FileDialogBuilder {
-    /// Shows the dialog to select a single file.
-    /// This is a blocking operation,
-    /// and should *NOT* be used when running on the main thread context.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::blocking::FileDialogBuilder;
-    /// #[tauri::command]
-    /// async fn my_command() {
-    ///   let file_path = FileDialogBuilder::new().pick_file();
-    ///   // do something with the optional file path here
-    ///   // the file path is `None` if the user closed the dialog
-    /// }
-    /// ```
-    pub fn pick_file(self) -> Option<PathBuf> {
-      #[allow(clippy::let_and_return)]
-      let response = run_dialog_sync!(self.0.pick_file());
-      #[cfg(not(target_os = "linux"))]
-      let response = response.map(|p| p.path().to_path_buf());
-      response
-    }
-
-    /// Shows the dialog to select multiple files.
-    /// This is a blocking operation,
-    /// and should *NOT* be used when running on the main thread context.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::blocking::FileDialogBuilder;
-    /// #[tauri::command]
-    /// async fn my_command() {
-    ///   let file_path = FileDialogBuilder::new().pick_files();
-    ///   // do something with the optional file paths here
-    ///   // the file paths value is `None` if the user closed the dialog
-    /// }
-    /// ```
-    pub fn pick_files(self) -> Option<Vec<PathBuf>> {
-      #[allow(clippy::let_and_return)]
-      let response = run_dialog_sync!(self.0.pick_files());
-      #[cfg(not(target_os = "linux"))]
-      let response =
-        response.map(|paths| paths.into_iter().map(|p| p.path().to_path_buf()).collect());
-      response
-    }
-
-    /// Shows the dialog to select a single folder.
-    /// This is a blocking operation,
-    /// and should *NOT* be used when running on the main thread context.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::blocking::FileDialogBuilder;
-    /// #[tauri::command]
-    /// async fn my_command() {
-    ///   let folder_path = FileDialogBuilder::new().pick_folder();
-    ///   // do something with the optional folder path here
-    ///   // the folder path is `None` if the user closed the dialog
-    /// }
-    /// ```
-    pub fn pick_folder(self) -> Option<PathBuf> {
-      #[allow(clippy::let_and_return)]
-      let response = run_dialog_sync!(self.0.pick_folder());
-      #[cfg(not(target_os = "linux"))]
-      let response = response.map(|p| p.path().to_path_buf());
-      response
-    }
-
-    /// Shows the dialog to select multiple folders.
-    /// This is a blocking operation,
-    /// and should *NOT* be used when running on the main thread context.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::blocking::FileDialogBuilder;
-    /// #[tauri::command]
-    /// async fn my_command() {
-    ///   let folder_paths = FileDialogBuilder::new().pick_folders();
-    ///   // do something with the optional folder paths here
-    ///   // the folder paths value is `None` if the user closed the dialog
-    /// }
-    /// ```
-    pub fn pick_folders(self) -> Option<Vec<PathBuf>> {
-      #[allow(clippy::let_and_return)]
-      let response = run_dialog_sync!(self.0.pick_folders());
-      #[cfg(not(target_os = "linux"))]
-      let response =
-        response.map(|paths| paths.into_iter().map(|p| p.path().to_path_buf()).collect());
-      response
-    }
-
-    /// Shows the dialog to save a file.
-    /// This is a blocking operation,
-    /// and should *NOT* be used when running on the main thread context.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::blocking::FileDialogBuilder;
-    /// #[tauri::command]
-    /// async fn my_command() {
-    ///   let file_path = FileDialogBuilder::new().save_file();
-    ///   // do something with the optional file path here
-    ///   // the file path is `None` if the user closed the dialog
-    /// }
-    /// ```
-    pub fn save_file(self) -> Option<PathBuf> {
-      #[allow(clippy::let_and_return)]
-      let response = run_dialog_sync!(self.0.save_file());
-      #[cfg(not(target_os = "linux"))]
-      let response = response.map(|p| p.path().to_path_buf());
-      response
-    }
-  }
-
-  impl MessageDialogBuilder {
-    //// Shows a message dialog.
-    ///
-    /// - In `Ok` dialog, it will return `true` when `OK` was pressed.
-    /// - In `OkCancel` dialog, it will return `true` when `OK` was pressed.
-    /// - In `YesNo` dialog, it will return `true` when `Yes` was pressed.
-    pub fn show(self) -> bool {
-      let (tx, rx) = sync_channel(1);
-      let f = move |response| {
-        tx.send(response).unwrap();
-      };
-      run_dialog!(self.0.show(), f);
-      rx.recv().unwrap()
-    }
-  }
-
-  /// Displays a dialog with a message and an optional title with a "yes" and a "no" button and wait for it to be closed.
-  ///
-  /// This is a blocking operation,
-  /// and should *NOT* be used when running on the main thread context.
-  ///
-  /// # Examples
-  ///
-  /// ```rust,no_run
-  /// use tauri::api::dialog::blocking::ask;
-  /// # let app = tauri::Builder::default().build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")).unwrap();
-  /// # let window = tauri::Manager::get_window(&app, "main").unwrap();
-  /// let answer = ask(Some(&window), "Tauri", "Is Tauri awesome?");
-  /// // do something with `answer`
-  /// ```
-  #[allow(unused_variables)]
-  pub fn ask<R: Runtime>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-  ) -> bool {
-    run_message_dialog(parent_window, title, message, rfd::MessageButtons::YesNo)
-  }
-
-  /// Displays a dialog with a message and an optional title with an "ok" and a "cancel" button and wait for it to be closed.
-  ///
-  /// This is a blocking operation,
-  /// and should *NOT* be used when running on the main thread context.
-  ///
-  /// # Examples
-  ///
-  /// ```rust,no_run
-  /// use tauri::api::dialog::blocking::confirm;
-  /// # let app = tauri::Builder::default().build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")).unwrap();
-  /// # let window = tauri::Manager::get_window(&app, "main").unwrap();
-  /// let answer = confirm(Some(&window), "Tauri", "Are you sure?");
-  /// // do something with `answer`
-  /// ```
-  #[allow(unused_variables)]
-  pub fn confirm<R: Runtime>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-  ) -> bool {
-    run_message_dialog(parent_window, title, message, rfd::MessageButtons::OkCancel)
-  }
-
-  /// Displays a message dialog and wait for it to be closed.
-  ///
-  /// This is a blocking operation,
-  /// and should *NOT* be used when running on the main thread context.
-  ///
-  /// # Examples
-  ///
-  /// ```rust,no_run
-  /// use tauri::api::dialog::blocking::message;
-  /// # let app = tauri::Builder::default().build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")).unwrap();
-  /// # let window = tauri::Manager::get_window(&app, "main").unwrap();
-  /// message(Some(&window), "Tauri", "Tauri is awesome!");
-  /// ```
-  #[allow(unused_variables)]
-  pub fn message<R: Runtime>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-  ) {
-    let _ = run_message_dialog(parent_window, title, message, rfd::MessageButtons::Ok);
-  }
-
-  #[allow(unused_variables)]
-  fn run_message_dialog<R: Runtime>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-    buttons: rfd::MessageButtons,
-  ) -> bool {
-    let (tx, rx) = sync_channel(1);
-    super::nonblocking::run_message_dialog(
-      parent_window,
-      title,
-      message,
-      buttons,
-      MessageDialogKind::Info,
-      move |response| {
-        tx.send(response).unwrap();
-      },
-    );
-    rx.recv().unwrap()
-  }
-}
-
-mod nonblocking {
-  use super::{MessageDialogButtons, MessageDialogKind};
-  use crate::{Runtime, Window};
-  use std::path::{Path, PathBuf};
-
-  file_dialog_builder!();
-  message_dialog_builder!();
-
-  impl FileDialogBuilder {
-    /// Shows the dialog to select a single file.
-    /// This is not a blocking operation,
-    /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-    ///
-    /// For usage in other contexts such as commands, prefer [`Self::pick_file`].
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::FileDialogBuilder;
-    /// tauri::Builder::default()
-    ///   .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
-    ///   .expect("failed to build tauri app")
-    ///   .run(|_app, _event| {
-    ///     FileDialogBuilder::new().pick_file(|file_path| {
-    ///       // do something with the optional file path here
-    ///       // the file path is `None` if the user closed the dialog
-    ///     })
-    ///   })
-    /// ```
-    pub fn pick_file<F: FnOnce(Option<PathBuf>) + Send + 'static>(self, f: F) {
-      #[cfg(not(target_os = "linux"))]
-      let f = |path: Option<rfd::FileHandle>| f(path.map(|p| p.path().to_path_buf()));
-      run_file_dialog!(self.0.pick_file(), f)
-    }
-
-    /// Shows the dialog to select multiple files.
-    /// This is not a blocking operation,
-    /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::FileDialogBuilder;
-    /// tauri::Builder::default()
-    ///   .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
-    ///   .expect("failed to build tauri app")
-    ///   .run(|_app, _event| {
-    ///     FileDialogBuilder::new().pick_files(|file_paths| {
-    ///       // do something with the optional file paths here
-    ///       // the file paths value is `None` if the user closed the dialog
-    ///     })
-    ///   })
-    /// ```
-    pub fn pick_files<F: FnOnce(Option<Vec<PathBuf>>) + Send + 'static>(self, f: F) {
-      #[cfg(not(target_os = "linux"))]
-      let f = |paths: Option<Vec<rfd::FileHandle>>| {
-        f(paths.map(|list| list.into_iter().map(|p| p.path().to_path_buf()).collect()))
-      };
-      run_file_dialog!(self.0.pick_files(), f)
-    }
-
-    /// Shows the dialog to select a single folder.
-    /// This is not a blocking operation,
-    /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::FileDialogBuilder;
-    /// tauri::Builder::default()
-    ///   .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
-    ///   .expect("failed to build tauri app")
-    ///   .run(|_app, _event| {
-    ///     FileDialogBuilder::new().pick_folder(|folder_path| {
-    ///       // do something with the optional folder path here
-    ///       // the folder path is `None` if the user closed the dialog
-    ///     })
-    ///   })
-    /// ```
-    pub fn pick_folder<F: FnOnce(Option<PathBuf>) + Send + 'static>(self, f: F) {
-      #[cfg(not(target_os = "linux"))]
-      let f = |path: Option<rfd::FileHandle>| f(path.map(|p| p.path().to_path_buf()));
-      run_file_dialog!(self.0.pick_folder(), f)
-    }
-
-    /// Shows the dialog to select multiple folders.
-    /// This is not a blocking operation,
-    /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::FileDialogBuilder;
-    /// tauri::Builder::default()
-    ///   .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
-    ///   .expect("failed to build tauri app")
-    ///   .run(|_app, _event| {
-    ///     FileDialogBuilder::new().pick_folders(|file_paths| {
-    ///       // do something with the optional folder paths here
-    ///       // the folder paths value is `None` if the user closed the dialog
-    ///     })
-    ///   })
-    /// ```
-    pub fn pick_folders<F: FnOnce(Option<Vec<PathBuf>>) + Send + 'static>(self, f: F) {
-      #[cfg(not(target_os = "linux"))]
-      let f = |paths: Option<Vec<rfd::FileHandle>>| {
-        f(paths.map(|list| list.into_iter().map(|p| p.path().to_path_buf()).collect()))
-      };
-      run_file_dialog!(self.0.pick_folders(), f)
-    }
-
-    /// Shows the dialog to save a file.
-    ///
-    /// This is not a blocking operation,
-    /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-    ///
-    /// # Examples
-    ///
-    /// ```rust,no_run
-    /// use tauri::api::dialog::FileDialogBuilder;
-    /// tauri::Builder::default()
-    ///   .build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json"))
-    ///   .expect("failed to build tauri app")
-    ///   .run(|_app, _event| {
-    ///     FileDialogBuilder::new().save_file(|file_path| {
-    ///       // do something with the optional file path here
-    ///       // the file path is `None` if the user closed the dialog
-    ///     })
-    ///   })
-    /// ```
-    pub fn save_file<F: FnOnce(Option<PathBuf>) + Send + 'static>(self, f: F) {
-      #[cfg(not(target_os = "linux"))]
-      let f = |path: Option<rfd::FileHandle>| f(path.map(|p| p.path().to_path_buf()));
-      run_file_dialog!(self.0.save_file(), f)
-    }
-  }
-
-  impl MessageDialogBuilder {
-    /// Shows a message dialog:
-    ///
-    /// - In `Ok` dialog, it will call the closure with `true` when `OK` was pressed
-    /// - In `OkCancel` dialog, it will call the closure with `true` when `OK` was pressed
-    /// - In `YesNo` dialog, it will call the closure with `true` when `Yes` was pressed
-    pub fn show<F: FnOnce(bool) + Send + 'static>(self, f: F) {
-      run_dialog!(self.0.show(), f);
-    }
-  }
-
-  /// Displays a non-blocking dialog with a message and an optional title with a "yes" and a "no" button.
-  ///
-  /// This is not a blocking operation,
-  /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-  ///
-  /// # Examples
-  ///
-  /// ```rust,no_run
-  /// use tauri::api::dialog::ask;
-  /// # let app = tauri::Builder::default().build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")).unwrap();
-  /// # let window = tauri::Manager::get_window(&app, "main").unwrap();
-  /// ask(Some(&window), "Tauri", "Is Tauri awesome?", |answer| {
-  ///   // do something with `answer`
-  /// });
-  /// ```
-  #[allow(unused_variables)]
-  pub fn ask<R: Runtime, F: FnOnce(bool) + Send + 'static>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-    f: F,
-  ) {
-    run_message_dialog(
-      parent_window,
-      title,
-      message,
-      rfd::MessageButtons::YesNo,
-      MessageDialogKind::Info,
-      f,
-    )
-  }
-
-  /// Displays a non-blocking dialog with a message and an optional title with an "ok" and a "cancel" button.
-  ///
-  /// This is not a blocking operation,
-  /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-  ///
-  /// # Examples
-  ///
-  /// ```rust,no_run
-  /// use tauri::api::dialog::confirm;
-  /// # let app = tauri::Builder::default().build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")).unwrap();
-  /// # let window = tauri::Manager::get_window(&app, "main").unwrap();
-  /// confirm(Some(&window), "Tauri", "Are you sure?", |answer| {
-  ///   // do something with `answer`
-  /// });
-  /// ```
-  #[allow(unused_variables)]
-  pub fn confirm<R: Runtime, F: FnOnce(bool) + Send + 'static>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-    f: F,
-  ) {
-    run_message_dialog(
-      parent_window,
-      title,
-      message,
-      rfd::MessageButtons::OkCancel,
-      MessageDialogKind::Info,
-      f,
-    )
-  }
-
-  /// Displays a non-blocking message dialog.
-  ///
-  /// This is not a blocking operation,
-  /// and should be used when running on the main thread to avoid deadlocks with the event loop.
-  ///
-  /// # Examples
-  ///
-  /// ```rust,no_run
-  /// use tauri::api::dialog::message;
-  /// # let app = tauri::Builder::default().build(tauri::generate_context!("test/fixture/src-tauri/tauri.conf.json")).unwrap();
-  /// # let window = tauri::Manager::get_window(&app, "main").unwrap();
-  /// message(Some(&window), "Tauri", "Tauri is awesome!");
-  /// ```
-  #[allow(unused_variables)]
-  pub fn message<R: Runtime>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-  ) {
-    run_message_dialog(
-      parent_window,
-      title,
-      message,
-      rfd::MessageButtons::Ok,
-      MessageDialogKind::Info,
-      |_| {},
-    )
-  }
-
-  #[allow(unused_variables)]
-  pub(crate) fn run_message_dialog<R: Runtime, F: FnOnce(bool) + Send + 'static>(
-    parent_window: Option<&Window<R>>,
-    title: impl AsRef<str>,
-    message: impl AsRef<str>,
-    buttons: rfd::MessageButtons,
-    level: MessageDialogKind,
-    f: F,
-  ) {
-    let title = title.as_ref().to_string();
-    let message = message.as_ref().to_string();
-    #[allow(unused_mut)]
-    let mut builder = rfd::MessageDialog::new()
-      .set_title(&title)
-      .set_description(&message)
-      .set_buttons(buttons)
-      .set_level(level.into());
-
-    #[cfg(any(windows, target_os = "macos"))]
-    {
-      if let Some(window) = parent_window {
-        builder = builder.set_parent(window);
-      }
-    }
-
-    run_dialog!(builder.show(), f)
-  }
-}

+ 0 - 3
core/tauri/src/api/mod.rs

@@ -4,9 +4,6 @@
 
 //! The Tauri API interface.
 
-#[cfg(all(desktop, feature = "dialog"))]
-#[cfg_attr(doc_cfg, doc(cfg(all(desktop, feature = "dialog"))))]
-pub mod dialog;
 pub mod dir;
 pub mod file;
 #[cfg(feature = "http-api")]

+ 8 - 45
core/tauri/src/app.rs

@@ -797,49 +797,15 @@ impl<R: Runtime> App<R> {
 
 #[cfg(updater)]
 impl<R: Runtime> App<R> {
-  /// Runs the updater hook with built-in dialog.
-  fn run_updater_dialog(&self) {
-    let handle = self.handle();
-
-    crate::async_runtime::spawn(async move { updater::check_update_with_dialog(handle).await });
-  }
-
   fn run_updater(&self) {
-    let handle = self.handle();
-    let handle_ = handle.clone();
-    let updater_config = self.manager.config().tauri.updater.clone();
     // check if updater is active or not
-    if updater_config.active {
-      if updater_config.dialog {
-        #[cfg(not(target_os = "linux"))]
-        let updater_enabled = true;
-        #[cfg(target_os = "linux")]
-        let updater_enabled = cfg!(dev) || self.state::<Env>().appimage.is_some();
-        if updater_enabled {
-          // if updater dialog is enabled spawn a new task
-          self.run_updater_dialog();
-          // When dialog is enabled, if user want to recheck
-          // if an update is available after first start
-          // invoke the Event `tauri://update` from JS or rust side.
-          handle.listen_global(updater::EVENT_CHECK_UPDATE, move |_msg| {
-            let handle = handle_.clone();
-            // re-spawn task inside tokyo to launch the download
-            // we don't need to emit anything as everything is handled
-            // by the process (user is asked to restart at the end)
-            // and it's handled by the updater
-            crate::async_runtime::spawn(
-              async move { updater::check_update_with_dialog(handle).await },
-            );
-          });
-        }
-      } else {
-        // we only listen for `tauri://update`
-        // once we receive the call, we check if an update is available or not
-        // if there is a new update we emit `tauri://update-available` with details
-        // this is the user responsibilities to display dialog and ask if user want to install
-        // to install the update you need to invoke the Event `tauri://update-install`
-        updater::listener(handle);
-      }
+    if self.manager.config().tauri.updater.active {
+      // we only listen for `tauri://update`
+      // once we receive the call, we check if an update is available or not
+      // if there is a new update we emit `tauri://update-available` with details
+      // this is the user responsibilities to display dialog and ask if user want to install
+      // to install the update you need to invoke the Event `tauri://update-install`
+      updater::listener(self.handle());
     }
   }
 }
@@ -1005,10 +971,7 @@ impl<R: Runtime> Builder<R> {
   /// tauri::Builder::default()
   ///   .setup(|app| {
   ///     let main_window = app.get_window("main").unwrap();
-  #[cfg_attr(
-    feature = "dialog",
-    doc = r#"     tauri::api::dialog::blocking::message(Some(&main_window), "Hello", "Welcome back!");"#
-  )]
+  ///     main_window.set_title("Tauri!");
   ///     Ok(())
   ///   });
   /// ```

+ 0 - 11
core/tauri/src/endpoints.rs

@@ -13,8 +13,6 @@ use serde_json::Value as JsonValue;
 use std::sync::Arc;
 
 mod app;
-#[cfg(dialog_any)]
-mod dialog;
 mod event;
 #[cfg(http_any)]
 mod http;
@@ -70,8 +68,6 @@ enum Module {
   #[cfg(shell_any)]
   Shell(shell::Cmd),
   Event(event::Cmd),
-  #[cfg(dialog_any)]
-  Dialog(dialog::Cmd),
   Notification(notification::Cmd),
   #[cfg(http_any)]
   Http(http::Cmd),
@@ -131,13 +127,6 @@ impl Module {
           .and_then(|r| r.json)
           .map_err(InvokeError::from_anyhow)
       }),
-      #[cfg(dialog_any)]
-      Self::Dialog(cmd) => resolver.respond_async(async move {
-        cmd
-          .run(context)
-          .and_then(|r| r.json)
-          .map_err(InvokeError::from_anyhow)
-      }),
       Self::Notification(cmd) => resolver.respond_async(async move {
         cmd
           .run(context)

+ 0 - 354
core/tauri/src/endpoints/dialog.rs

@@ -1,354 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-#![allow(unused_imports)]
-
-use super::{InvokeContext, InvokeResponse};
-use crate::Runtime;
-#[cfg(any(dialog_open, dialog_save))]
-use crate::{api::dialog::blocking::FileDialogBuilder, Manager, Scopes};
-use serde::{Deserialize, Deserializer};
-use tauri_macros::{command_enum, module_command_handler, CommandModule};
-
-use std::path::PathBuf;
-
-macro_rules! message_dialog {
-  ($fn_name: ident, $allowlist: ident, $button_labels_type: ty, $buttons: expr) => {
-    #[module_command_handler($allowlist)]
-    fn $fn_name<R: Runtime>(
-      context: InvokeContext<R>,
-      title: Option<String>,
-      message: String,
-      level: Option<MessageDialogType>,
-      button_labels: $button_labels_type,
-    ) -> super::Result<bool> {
-      let determine_button = $buttons;
-      let mut builder = crate::api::dialog::blocking::MessageDialogBuilder::new(
-        title.unwrap_or_else(|| context.window.app_handle.package_info().name.clone()),
-        message,
-      )
-      .buttons(determine_button(button_labels));
-      #[cfg(any(windows, target_os = "macos"))]
-      {
-        builder = builder.parent(&context.window);
-      }
-      if let Some(level) = level {
-        builder = builder.kind(level.into());
-      }
-      Ok(builder.show())
-    }
-  };
-}
-
-#[allow(dead_code)]
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct DialogFilter {
-  name: String,
-  extensions: Vec<String>,
-}
-
-/// The options for the open dialog API.
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct OpenDialogOptions {
-  /// The title of the dialog window.
-  pub title: Option<String>,
-  /// The filters of the dialog.
-  #[serde(default)]
-  pub filters: Vec<DialogFilter>,
-  /// Whether the dialog allows multiple selection or not.
-  #[serde(default)]
-  pub multiple: bool,
-  /// Whether the dialog is a directory selection (`true` value) or file selection (`false` value).
-  #[serde(default)]
-  pub directory: bool,
-  /// The initial path of the dialog.
-  pub default_path: Option<PathBuf>,
-  /// If [`Self::directory`] is true, indicates that it will be read recursively later.
-  /// Defines whether subdirectories will be allowed on the scope or not.
-  #[serde(default)]
-  pub recursive: bool,
-}
-
-/// The options for the save dialog API.
-#[derive(Debug, Clone, Deserialize)]
-#[serde(rename_all = "camelCase")]
-pub struct SaveDialogOptions {
-  /// The title of the dialog window.
-  pub title: Option<String>,
-  /// The filters of the dialog.
-  #[serde(default)]
-  pub filters: Vec<DialogFilter>,
-  /// The initial path of the dialog.
-  pub default_path: Option<PathBuf>,
-}
-
-/// Types of message, ask and confirm dialogs.
-#[non_exhaustive]
-#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum MessageDialogType {
-  /// Information dialog.
-  Info,
-  /// Warning dialog.
-  Warning,
-  /// Error dialog.
-  Error,
-}
-
-impl<'de> Deserialize<'de> for MessageDialogType {
-  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
-  where
-    D: Deserializer<'de>,
-  {
-    let s = String::deserialize(deserializer)?;
-    Ok(match s.to_lowercase().as_str() {
-      "info" => MessageDialogType::Info,
-      "warning" => MessageDialogType::Warning,
-      "error" => MessageDialogType::Error,
-      _ => MessageDialogType::Info,
-    })
-  }
-}
-
-#[cfg(any(dialog_message, dialog_ask, dialog_confirm))]
-impl From<MessageDialogType> for crate::api::dialog::MessageDialogKind {
-  fn from(kind: MessageDialogType) -> Self {
-    match kind {
-      MessageDialogType::Info => Self::Info,
-      MessageDialogType::Warning => Self::Warning,
-      MessageDialogType::Error => Self::Error,
-    }
-  }
-}
-
-/// The API descriptor.
-#[command_enum]
-#[derive(Deserialize, CommandModule)]
-#[serde(tag = "cmd", rename_all = "camelCase")]
-#[allow(clippy::enum_variant_names)]
-pub enum Cmd {
-  /// The open dialog API.
-  #[cmd(dialog_open, "dialog > open")]
-  OpenDialog { options: OpenDialogOptions },
-  /// The save dialog API.
-  #[cmd(dialog_save, "dialog > save")]
-  SaveDialog { options: SaveDialogOptions },
-  #[cmd(dialog_message, "dialog > message")]
-  MessageDialog {
-    title: Option<String>,
-    message: String,
-    #[serde(rename = "type")]
-    level: Option<MessageDialogType>,
-    #[serde(rename = "buttonLabel")]
-    button_label: Option<String>,
-  },
-  #[cmd(dialog_ask, "dialog > ask")]
-  AskDialog {
-    title: Option<String>,
-    message: String,
-    #[serde(rename = "type")]
-    level: Option<MessageDialogType>,
-    #[serde(rename = "buttonLabels")]
-    button_label: Option<(String, String)>,
-  },
-  #[cmd(dialog_confirm, "dialog > confirm")]
-  ConfirmDialog {
-    title: Option<String>,
-    message: String,
-    #[serde(rename = "type")]
-    level: Option<MessageDialogType>,
-    #[serde(rename = "buttonLabels")]
-    button_labels: Option<(String, String)>,
-  },
-}
-
-impl Cmd {
-  #[module_command_handler(dialog_open)]
-  #[allow(unused_variables)]
-  fn open_dialog<R: Runtime>(
-    context: InvokeContext<R>,
-    options: OpenDialogOptions,
-  ) -> super::Result<InvokeResponse> {
-    let mut dialog_builder = FileDialogBuilder::new();
-    #[cfg(any(windows, target_os = "macos"))]
-    {
-      dialog_builder = dialog_builder.set_parent(&context.window);
-    }
-    if let Some(title) = options.title {
-      dialog_builder = dialog_builder.set_title(&title);
-    }
-    if let Some(default_path) = options.default_path {
-      dialog_builder = set_default_path(dialog_builder, default_path);
-    }
-    for filter in options.filters {
-      let extensions: Vec<&str> = filter.extensions.iter().map(|s| &**s).collect();
-      dialog_builder = dialog_builder.add_filter(filter.name, &extensions);
-    }
-
-    let scopes = context.window.state::<Scopes>();
-
-    let res = if options.directory {
-      if options.multiple {
-        let folders = dialog_builder.pick_folders();
-        if let Some(folders) = &folders {
-          for folder in folders {
-            scopes
-              .allow_directory(folder, options.recursive)
-              .map_err(crate::error::into_anyhow)?;
-          }
-        }
-        folders.into()
-      } else {
-        let folder = dialog_builder.pick_folder();
-        if let Some(path) = &folder {
-          scopes
-            .allow_directory(path, options.recursive)
-            .map_err(crate::error::into_anyhow)?;
-        }
-        folder.into()
-      }
-    } else if options.multiple {
-      let files = dialog_builder.pick_files();
-      if let Some(files) = &files {
-        for file in files {
-          scopes.allow_file(file).map_err(crate::error::into_anyhow)?;
-        }
-      }
-      files.into()
-    } else {
-      let file = dialog_builder.pick_file();
-      if let Some(file) = &file {
-        scopes.allow_file(file).map_err(crate::error::into_anyhow)?;
-      }
-      file.into()
-    };
-
-    Ok(res)
-  }
-
-  #[module_command_handler(dialog_save)]
-  #[allow(unused_variables)]
-  fn save_dialog<R: Runtime>(
-    context: InvokeContext<R>,
-    options: SaveDialogOptions,
-  ) -> super::Result<Option<PathBuf>> {
-    let mut dialog_builder = FileDialogBuilder::new();
-    #[cfg(any(windows, target_os = "macos"))]
-    {
-      dialog_builder = dialog_builder.set_parent(&context.window);
-    }
-    if let Some(title) = options.title {
-      dialog_builder = dialog_builder.set_title(&title);
-    }
-    if let Some(default_path) = options.default_path {
-      dialog_builder = set_default_path(dialog_builder, default_path);
-    }
-    for filter in options.filters {
-      let extensions: Vec<&str> = filter.extensions.iter().map(|s| &**s).collect();
-      dialog_builder = dialog_builder.add_filter(filter.name, &extensions);
-    }
-
-    let scopes = context.window.state::<Scopes>();
-
-    let path = dialog_builder.save_file();
-    if let Some(p) = &path {
-      scopes.allow_file(p).map_err(crate::error::into_anyhow)?;
-    }
-
-    Ok(path)
-  }
-
-  message_dialog!(
-    message_dialog,
-    dialog_message,
-    Option<String>,
-    |label: Option<String>| {
-      label
-        .map(crate::api::dialog::MessageDialogButtons::OkWithLabel)
-        .unwrap_or(crate::api::dialog::MessageDialogButtons::Ok)
-    }
-  );
-
-  message_dialog!(
-    ask_dialog,
-    dialog_ask,
-    Option<(String, String)>,
-    |labels: Option<(String, String)>| {
-      labels
-        .map(|(yes, no)| crate::api::dialog::MessageDialogButtons::OkCancelWithLabels(yes, no))
-        .unwrap_or(crate::api::dialog::MessageDialogButtons::YesNo)
-    }
-  );
-
-  message_dialog!(
-    confirm_dialog,
-    dialog_confirm,
-    Option<(String, String)>,
-    |labels: Option<(String, String)>| {
-      labels
-        .map(|(ok, cancel)| {
-          crate::api::dialog::MessageDialogButtons::OkCancelWithLabels(ok, cancel)
-        })
-        .unwrap_or(crate::api::dialog::MessageDialogButtons::OkCancel)
-    }
-  );
-}
-
-#[cfg(any(dialog_open, dialog_save))]
-fn set_default_path(
-  mut dialog_builder: FileDialogBuilder,
-  default_path: PathBuf,
-) -> FileDialogBuilder {
-  if default_path.is_file() || !default_path.exists() {
-    if let (Some(parent), Some(file_name)) = (default_path.parent(), default_path.file_name()) {
-      if parent.components().count() > 0 {
-        dialog_builder = dialog_builder.set_directory(parent);
-      }
-      dialog_builder = dialog_builder.set_file_name(&file_name.to_string_lossy());
-    } else {
-      dialog_builder = dialog_builder.set_directory(default_path);
-    }
-    dialog_builder
-  } else {
-    dialog_builder.set_directory(default_path)
-  }
-}
-
-#[cfg(test)]
-mod tests {
-  use super::{OpenDialogOptions, SaveDialogOptions};
-  use quickcheck::{Arbitrary, Gen};
-
-  impl Arbitrary for OpenDialogOptions {
-    fn arbitrary(g: &mut Gen) -> Self {
-      Self {
-        filters: Vec::new(),
-        multiple: bool::arbitrary(g),
-        directory: bool::arbitrary(g),
-        default_path: Option::arbitrary(g),
-        title: Option::arbitrary(g),
-        recursive: bool::arbitrary(g),
-      }
-    }
-  }
-
-  impl Arbitrary for SaveDialogOptions {
-    fn arbitrary(g: &mut Gen) -> Self {
-      Self {
-        filters: Vec::new(),
-        default_path: Option::arbitrary(g),
-        title: Option::arbitrary(g),
-      }
-    }
-  }
-
-  #[tauri_macros::module_command_test(dialog_open, "dialog > open")]
-  #[quickcheck_macros::quickcheck]
-  fn open_dialog(_options: OpenDialogOptions) {}
-
-  #[tauri_macros::module_command_test(dialog_save, "dialog > save")]
-  #[quickcheck_macros::quickcheck]
-  fn save_dialog(_options: SaveDialogOptions) {}
-}

+ 0 - 93
core/tauri/src/updater/mod.rs

@@ -70,9 +70,6 @@ pub type Result<T> = std::result::Result<T, Error>;
 
 use crate::{runtime::EventLoopProxy, AppHandle, EventLoopMessage, Manager, Runtime, UpdaterEvent};
 
-#[cfg(desktop)]
-use crate::api::dialog::blocking::ask;
-
 #[cfg(mobile)]
 fn ask<R: Runtime>(
   _parent_window: Option<&crate::Window<R>>,
@@ -394,46 +391,6 @@ impl<R: Runtime> UpdateResponse<R> {
   }
 }
 
-/// Check if there is any new update with builtin dialog.
-pub(crate) async fn check_update_with_dialog<R: Runtime>(handle: AppHandle<R>) {
-  let updater_config = handle.config().tauri.updater.clone();
-  let package_info = handle.package_info().clone();
-  if let Some(endpoints) = updater_config.endpoints.clone() {
-    let endpoints = endpoints
-      .iter()
-      .map(|e| e.to_string())
-      .collect::<Vec<String>>();
-
-    let mut builder = self::core::builder(handle.clone())
-      .urls(&endpoints[..])
-      .current_version(package_info.version);
-    if let Some(target) = &handle.updater_settings.target {
-      builder = builder.target(target);
-    }
-
-    // check updates
-    match builder.build().await {
-      Ok(updater) => {
-        let pubkey = updater_config.pubkey.clone();
-
-        // if dialog enabled only
-        if updater.should_update && updater_config.dialog {
-          let body = updater.body.clone().unwrap_or_else(|| String::from(""));
-          let dialog =
-            prompt_for_install(&updater.clone(), &package_info.name, &body.clone(), pubkey).await;
-
-          if let Err(e) = dialog {
-            send_status_update(&handle, UpdaterEvent::Error(e.to_string()));
-          }
-        }
-      }
-      Err(e) => {
-        send_status_update(&handle, UpdaterEvent::Error(e.to_string()));
-      }
-    }
-  }
-}
-
 /// Updater listener
 /// This function should be run on the main thread once.
 pub(crate) fn listener<R: Runtime>(handle: AppHandle<R>) {
@@ -549,53 +506,3 @@ fn send_status_update<R: Runtime>(handle: &AppHandle<R>, message: UpdaterEvent)
     .create_proxy()
     .send_event(EventLoopMessage::Updater(message));
 }
-
-// Prompt a dialog asking if the user want to install the new version
-// Maybe we should add an option to customize it in future versions.
-async fn prompt_for_install<R: Runtime>(
-  update: &self::core::Update<R>,
-  app_name: &str,
-  body: &str,
-  pubkey: String,
-) -> Result<()> {
-  let windows = update.app.windows();
-  let parent_window = windows.values().next();
-
-  // todo(lemarier): We should review this and make sure we have
-  // something more conventional.
-  let should_install = ask(
-    parent_window,
-    format!(r#"A new version of {app_name} is available! "#),
-    format!(
-      r#"{app_name} {} is now available -- you have {}.
-
-Would you like to install it now?
-
-Release Notes:
-{body}"#,
-      update.version, update.current_version
-    ),
-  );
-
-  if should_install {
-    // Launch updater download process
-    // macOS we display the `Ready to restart dialog` asking to restart
-    // Windows is closing the current App and launch the downloaded MSI when ready (the process stop here)
-    // Linux we replace the AppImage by launching a new install, it start a new AppImage instance, so we're closing the previous. (the process stop here)
-    update
-      .download_and_install(pubkey.clone(), |_, _| (), || ())
-      .await?;
-
-    // Ask user if we need to restart the application
-    let should_exit = ask(
-      parent_window,
-      "Ready to Restart",
-      "The installation was successful, do you want to restart the application now?",
-    );
-    if should_exit {
-      update.app.restart();
-    }
-  }
-
-  Ok(())
-}

+ 4 - 3
core/tests/app-updater/tauri.conf.json

@@ -28,12 +28,13 @@
     },
     "updater": {
       "active": true,
-      "dialog": false,
       "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK",
-      "endpoints": ["http://localhost:3007"],
+      "endpoints": [
+        "http://localhost:3007"
+      ],
       "windows": {
         "installMode": "quiet"
       }
     }
   }
-}
+}

文件差异内容过多而无法显示
+ 0 - 0
examples/api/dist/assets/index.css


文件差异内容过多而无法显示
+ 0 - 0
examples/api/dist/assets/index.js


+ 0 - 24
examples/api/src-tauri/Cargo.lock

@@ -2785,29 +2785,6 @@ dependencies = [
  "winreg",
 ]
 
-[[package]]
-name = "rfd"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc2583255eadc4e0d816cb7648371cc91e49cbac85b0748b6ab417093bff4040"
-dependencies = [
- "block",
- "dispatch",
- "glib-sys",
- "gobject-sys",
- "gtk-sys",
- "js-sys",
- "log",
- "objc",
- "objc-foundation",
- "objc_id",
- "raw-window-handle",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
- "windows 0.44.0",
-]
-
 [[package]]
 name = "rustc_version"
 version = "0.3.3"
@@ -3357,7 +3334,6 @@ dependencies = [
  "raw-window-handle",
  "regex",
  "reqwest",
- "rfd",
  "semver 1.0.16",
  "serde",
  "serde_json",

+ 0 - 20
examples/api/src-tauri/src/tray.rs

@@ -4,10 +4,6 @@
 
 use std::sync::atomic::{AtomicBool, Ordering};
 use tauri::{
-  api::{
-    dialog::{MessageDialogBuilder, MessageDialogButtons},
-    shell,
-  },
   CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, WindowBuilder, WindowUrl,
 };
 
@@ -25,7 +21,6 @@ pub fn create_tray(app: &tauri::App) -> tauri::Result<()> {
 
   tray_menu1 = tray_menu1
     .add_item(CustomMenuItem::new("switch_menu", "Switch Menu"))
-    .add_item(CustomMenuItem::new("about", "About"))
     .add_item(CustomMenuItem::new("exit_app", "Quit"))
     .add_item(CustomMenuItem::new("destroy", "Destroy"));
 
@@ -33,7 +28,6 @@ pub fn create_tray(app: &tauri::App) -> tauri::Result<()> {
     .add_item(CustomMenuItem::new("toggle", "Toggle"))
     .add_item(CustomMenuItem::new("new", "New window"))
     .add_item(CustomMenuItem::new("switch_menu", "Switch Menu"))
-    .add_item(CustomMenuItem::new("about", "About"))
     .add_item(CustomMenuItem::new("exit_app", "Quit"))
     .add_item(CustomMenuItem::new("destroy", "Destroy"));
   let is_menu1 = AtomicBool::new(true);
@@ -118,20 +112,6 @@ pub fn create_tray(app: &tauri::App) -> tauri::Result<()> {
               tray_handle.set_tooltip(tooltip).unwrap();
               is_menu1.store(!flag, Ordering::Relaxed);
             }
-            "about" => {
-              let window = handle.get_window("main").unwrap();
-              MessageDialogBuilder::new("About app", "Tauri demo app")
-                .parent(&window)
-                .buttons(MessageDialogButtons::OkCancelWithLabels(
-                  "Homepage".into(),
-                  "know it".into(),
-                ))
-                .show(move |ok| {
-                  if ok {
-                    shell::open(&window.shell_scope(), "https://tauri.app/", None).unwrap();
-                  }
-                });
-            }
             _ => {}
           }
         }

+ 34 - 10
examples/api/src-tauri/tauri.conf.json

@@ -83,7 +83,6 @@
     },
     "updater": {
       "active": true,
-      "dialog": false,
       "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK",
       "endpoints": [
         "https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}"
@@ -93,8 +92,14 @@
       "all": true,
       "fs": {
         "scope": {
-          "allow": ["$APPDATA/db/**", "$DOWNLOAD/**", "$RESOURCE/**"],
-          "deny": ["$APPDATA/db/*.stronghold"]
+          "allow": [
+            "$APPDATA/db/**",
+            "$DOWNLOAD/**",
+            "$RESOURCE/**"
+          ],
+          "deny": [
+            "$APPDATA/db/*.stronghold"
+          ]
         }
       },
       "shell": {
@@ -103,31 +108,50 @@
           {
             "name": "sh",
             "cmd": "sh",
-            "args": ["-c", { "validator": "\\S+" }]
+            "args": [
+              "-c",
+              {
+                "validator": "\\S+"
+              }
+            ]
           },
           {
             "name": "cmd",
             "cmd": "cmd",
-            "args": ["/C", { "validator": "\\S+" }]
+            "args": [
+              "/C",
+              {
+                "validator": "\\S+"
+              }
+            ]
           }
         ]
       },
       "protocol": {
         "asset": true,
         "assetScope": {
-          "allow": ["$APPDATA/db/**", "$RESOURCE/**"],
-          "deny": ["$APPDATA/db/*.stronghold"]
+          "allow": [
+            "$APPDATA/db/**",
+            "$RESOURCE/**"
+          ],
+          "deny": [
+            "$APPDATA/db/*.stronghold"
+          ]
         }
       },
       "http": {
-        "scope": ["http://localhost:3003"]
+        "scope": [
+          "http://localhost:3003"
+        ]
       }
     },
     "windows": [],
     "security": {
       "csp": {
         "default-src": "'self' customprotocol: asset:",
-        "font-src": ["https://fonts.gstatic.com"],
+        "font-src": [
+          "https://fonts.gstatic.com"
+        ],
         "img-src": "'self' asset: https://asset.localhost blob: data:",
         "style-src": "'unsafe-inline' 'self' https://fonts.googleapis.com"
       },
@@ -139,4 +163,4 @@
       "menuOnLeftClick": false
     }
   }
-}
+}

+ 0 - 39
examples/api/src/App.svelte

@@ -7,7 +7,6 @@
   import Welcome from './views/Welcome.svelte'
   import Cli from './views/Cli.svelte'
   import Communication from './views/Communication.svelte'
-  import Dialog from './views/Dialog.svelte'
   import Http from './views/Http.svelte'
   import Notifications from './views/Notifications.svelte'
   import Window from './views/Window.svelte'
@@ -19,17 +18,6 @@
 
   import { onMount } from 'svelte'
   import { listen } from '@tauri-apps/api/event'
-  import { ask } from '@tauri-apps/api/dialog'
-
-  if (appWindow.label !== 'main') {
-    appWindow.onCloseRequested(async (event) => {
-      const confirmed = await confirm('Are you sure?')
-      if (!confirmed) {
-        // user did not confirm closing the window; let's prevent it
-        event.preventDefault()
-      }
-    })
-  }
 
   appWindow.onFileDropEvent((event) => {
     onMessage(`File drop: ${JSON.stringify(event.payload)}`)
@@ -54,11 +42,6 @@
       component: Cli,
       icon: 'i-codicon-terminal'
     },
-    !isMobile && {
-      label: 'Dialog',
-      component: Dialog,
-      icon: 'i-codicon-multiple-windows'
-    },
     {
       label: 'HTTP',
       component: Http,
@@ -125,21 +108,6 @@
     ;(await window.isMaximized()) ? window.unmaximize() : window.maximize()
   }
 
-  let confirmed_close = false
-  async function close() {
-    if (!confirmed_close) {
-      confirmed_close = await ask(
-        'Are you sure that you want to close this window?',
-        {
-          title: 'Tauri API'
-        }
-      )
-      if (confirmed_close) {
-        getCurrent().close()
-      }
-    }
-  }
-
   // dark/light
   let isDark
   onMount(() => {
@@ -326,13 +294,6 @@
           <div class="i-codicon-chrome-maximize" />
         {/if}
       </span>
-      <span
-        title="Close"
-        class="hover:bg-red-700 dark:hover:bg-red-700 hover:text-darkPrimaryText active:bg-red-700/90 dark:active:bg-red-700/90 active:text-darkPrimaryText"
-        on:click={close}
-      >
-        <div class="i-codicon-chrome-close" />
-      </span>
     </span>
   </div>
 {/if}

+ 0 - 87
examples/api/src/views/Dialog.svelte

@@ -1,87 +0,0 @@
-<script>
-  import { open, save } from '@tauri-apps/api/dialog'
-
-  export let onMessage
-  let defaultPath = null
-  let filter = null
-  let multiple = false
-  let directory = false
-
-  function arrayBufferToBase64(buffer, callback) {
-    var blob = new Blob([buffer], {
-      type: 'application/octet-binary'
-    })
-    var reader = new FileReader()
-    reader.onload = function (evt) {
-      var dataurl = evt.target.result
-      callback(dataurl.substr(dataurl.indexOf(',') + 1))
-    }
-    reader.readAsDataURL(blob)
-  }
-
-  function openDialog() {
-    open({
-      title: 'My wonderful open dialog',
-      defaultPath,
-      filters: filter
-        ? [
-            {
-              name: 'Tauri Example',
-              extensions: filter.split(',').map((f) => f.trim())
-            }
-          ]
-        : [],
-      multiple,
-      directory
-    })
-      .then(onMessage)
-      .catch(onMessage)
-  }
-
-  function saveDialog() {
-    save({
-      title: 'My wonderful save dialog',
-      defaultPath,
-      filters: filter
-        ? [
-            {
-              name: 'Tauri Example',
-              extensions: filter.split(',').map((f) => f.trim())
-            }
-          ]
-        : []
-    })
-      .then(onMessage)
-      .catch(onMessage)
-  }
-</script>
-
-<div class="flex gap-2 children:grow">
-  <input
-    class="input"
-    id="dialog-default-path"
-    placeholder="Default path"
-    bind:value={defaultPath}
-  />
-  <input
-    class="input"
-    id="dialog-filter"
-    placeholder="Extensions filter, comma-separated"
-    bind:value={filter}
-  />
-</div>
-
-<br />
-<div>
-  <input type="checkbox" id="dialog-multiple" bind:checked={multiple} />
-  <label for="dialog-multiple">Multiple</label>
-</div>
-<div>
-  <input type="checkbox" id="dialog-directory" bind:checked={directory} />
-  <label for="dialog-directory">Directory</label>
-</div>
-<br />
-<button class="btn" id="open-dialog" on:click={openDialog}>Open dialog</button>
-<button class="btn" id="save-dialog" on:click={saveDialog}
-  >Open save dialog</button
->

+ 0 - 1
examples/updater/src-tauri/tauri.conf.json

@@ -63,7 +63,6 @@
     },
     "updater": {
       "active": true,
-      "dialog": true,
       "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK",
       "endpoints": [
         "https://tauri-update-server.vercel.app/update/{{target}}/{{current_version}}"

文件差异内容过多而无法显示
+ 0 - 0
tooling/api/docs/js-api.json


+ 0 - 321
tooling/api/src/dialog.ts

@@ -1,321 +0,0 @@
-// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
-// SPDX-License-Identifier: Apache-2.0
-// SPDX-License-Identifier: MIT
-
-/**
- * Native system dialogs for opening and saving files.
- *
- * This package is also accessible with `window.__TAURI__.dialog` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.
- *
- * The APIs must be added to [`tauri.allowlist.dialog`](https://tauri.app/v1/api/config/#allowlistconfig.dialog) in `tauri.conf.json`:
- * ```json
- * {
- *   "tauri": {
- *     "allowlist": {
- *       "dialog": {
- *         "all": true, // enable all dialog APIs
- *         "ask": true, // enable dialog ask API
- *         "confirm": true, // enable dialog confirm API
- *         "message": true, // enable dialog message API
- *         "open": true, // enable file open API
- *         "save": true // enable file save API
- *       }
- *     }
- *   }
- * }
- * ```
- * It is recommended to allowlist only the APIs you use for optimal bundle size and security.
- * @module
- */
-
-import { invokeTauriCommand } from './helpers/tauri'
-
-/**
- * Extension filters for the file dialog.
- *
- * @since 1.0.0
- */
-interface DialogFilter {
-  /** Filter name. */
-  name: string
-  /**
-   * Extensions to filter, without a `.` prefix.
-   * @example
-   * ```typescript
-   * extensions: ['svg', 'png']
-   * ```
-   */
-  extensions: string[]
-}
-
-/**
- * Options for the open dialog.
- *
- * @since 1.0.0
- */
-interface OpenDialogOptions {
-  /** The title of the dialog window. */
-  title?: string
-  /** The filters of the dialog. */
-  filters?: DialogFilter[]
-  /** Initial directory or file path. */
-  defaultPath?: string
-  /** Whether the dialog allows multiple selection or not. */
-  multiple?: boolean
-  /** Whether the dialog is a directory selection or not. */
-  directory?: boolean
-  /**
-   * If `directory` is true, indicates that it will be read recursively later.
-   * Defines whether subdirectories will be allowed on the scope or not.
-   */
-  recursive?: boolean
-}
-
-/**
- * Options for the save dialog.
- *
- * @since 1.0.0
- */
-interface SaveDialogOptions {
-  /** The title of the dialog window. */
-  title?: string
-  /** The filters of the dialog. */
-  filters?: DialogFilter[]
-  /**
-   * Initial directory or file path.
-   * If it's a directory path, the dialog interface will change to that folder.
-   * If it's not an existing directory, the file name will be set to the dialog's file name input and the dialog will be set to the parent folder.
-   */
-  defaultPath?: string
-}
-
-/**
- * @since 1.0.0
- */
-interface MessageDialogOptions {
-  /** The title of the dialog. Defaults to the app name. */
-  title?: string
-  /** The type of the dialog. Defaults to `info`. */
-  type?: 'info' | 'warning' | 'error'
-  /** The label of the confirm button. */
-  okLabel?: string
-}
-
-interface ConfirmDialogOptions {
-  /** The title of the dialog. Defaults to the app name. */
-  title?: string
-  /** The type of the dialog. Defaults to `info`. */
-  type?: 'info' | 'warning' | 'error'
-  /** The label of the confirm button. */
-  okLabel?: string
-  /** The label of the cancel button. */
-  cancelLabel?: string
-}
-
-/**
- * Open a file/directory selection dialog.
- *
- * The selected paths are added to the filesystem and asset protocol allowlist scopes.
- * When security is more important than the easy of use of this API,
- * prefer writing a dedicated command instead.
- *
- * Note that the allowlist scope change is not persisted, so the values are cleared when the application is restarted.
- * You can save it to the filesystem using [tauri-plugin-persisted-scope](https://github.com/tauri-apps/tauri-plugin-persisted-scope).
- * @example
- * ```typescript
- * import { open } from '@tauri-apps/api/dialog';
- * // Open a selection dialog for image files
- * const selected = await open({
- *   multiple: true,
- *   filters: [{
- *     name: 'Image',
- *     extensions: ['png', 'jpeg']
- *   }]
- * });
- * ```
- * Note that the `open` function returns a conditional type depending on the `multiple` option:
- * - false (default) -> `Promise<string | null>`
- * - true -> `Promise<string[] | null>`
- *
- * @returns A promise resolving to the selected path(s)
- *
- * @since 1.0.0
- */
-async function open(
-  options?: OpenDialogOptions & { multiple?: false }
-): Promise<null | string>
-async function open(
-  options?: OpenDialogOptions & { multiple?: true }
-): Promise<null | string[]>
-async function open(
-  options: OpenDialogOptions
-): Promise<null | string[] | string>
-async function open(
-  options: OpenDialogOptions = {}
-): Promise<null | string[] | string> {
-  if (typeof options === 'object') {
-    Object.freeze(options)
-  }
-
-  return invokeTauriCommand({
-    __tauriModule: 'Dialog',
-    message: {
-      cmd: 'openDialog',
-      options
-    }
-  })
-}
-
-/**
- * Open a file/directory save dialog.
- *
- * The selected path is added to the filesystem and asset protocol allowlist scopes.
- * When security is more important than the easy of use of this API,
- * prefer writing a dedicated command instead.
- *
- * Note that the allowlist scope change is not persisted, so the values are cleared when the application is restarted.
- * You can save it to the filesystem using [tauri-plugin-persisted-scope](https://github.com/tauri-apps/tauri-plugin-persisted-scope).
- * @example
- * ```typescript
- * import { save } from '@tauri-apps/api/dialog';
- * const filePath = await save({
- *   filters: [{
- *     name: 'Image',
- *     extensions: ['png', 'jpeg']
- *   }]
- * });
- * ```
- *
- * @returns A promise resolving to the selected path.
- *
- * @since 1.0.0
- */
-async function save(options: SaveDialogOptions = {}): Promise<string | null> {
-  if (typeof options === 'object') {
-    Object.freeze(options)
-  }
-
-  return invokeTauriCommand({
-    __tauriModule: 'Dialog',
-    message: {
-      cmd: 'saveDialog',
-      options
-    }
-  })
-}
-
-/**
- * Shows a message dialog with an `Ok` button.
- * @example
- * ```typescript
- * import { message } from '@tauri-apps/api/dialog';
- * await message('Tauri is awesome', 'Tauri');
- * await message('File not found', { title: 'Tauri', type: 'error' });
- * ```
- *
- * @param message The message to show.
- * @param options The dialog's options. If a string, it represents the dialog title.
- *
- * @returns A promise indicating the success or failure of the operation.
- *
- * @since 1.0.0
- *
- */
-async function message(
-  message: string,
-  options?: string | MessageDialogOptions
-): Promise<void> {
-  const opts = typeof options === 'string' ? { title: options } : options
-  return invokeTauriCommand({
-    __tauriModule: 'Dialog',
-    message: {
-      cmd: 'messageDialog',
-      message: message.toString(),
-      title: opts?.title?.toString(),
-      type: opts?.type,
-      buttonLabel: opts?.okLabel?.toString()
-    }
-  })
-}
-
-/**
- * Shows a question dialog with `Yes` and `No` buttons.
- * @example
- * ```typescript
- * import { ask } from '@tauri-apps/api/dialog';
- * const yes = await ask('Are you sure?', 'Tauri');
- * const yes2 = await ask('This action cannot be reverted. Are you sure?', { title: 'Tauri', type: 'warning' });
- * ```
- *
- * @param message The message to show.
- * @param options The dialog's options. If a string, it represents the dialog title.
- *
- * @returns A promise resolving to a boolean indicating whether `Yes` was clicked or not.
- *
- * @since 1.0.0
- */
-async function ask(
-  message: string,
-  options?: string | ConfirmDialogOptions
-): Promise<boolean> {
-  const opts = typeof options === 'string' ? { title: options } : options
-  return invokeTauriCommand({
-    __tauriModule: 'Dialog',
-    message: {
-      cmd: 'askDialog',
-      message: message.toString(),
-      title: opts?.title?.toString(),
-      type: opts?.type,
-      buttonLabels: [
-        opts?.okLabel?.toString() ?? 'Yes',
-        opts?.cancelLabel?.toString() ?? 'No'
-      ]
-    }
-  })
-}
-
-/**
- * Shows a question dialog with `Ok` and `Cancel` buttons.
- * @example
- * ```typescript
- * import { confirm } from '@tauri-apps/api/dialog';
- * const confirmed = await confirm('Are you sure?', 'Tauri');
- * const confirmed2 = await confirm('This action cannot be reverted. Are you sure?', { title: 'Tauri', type: 'warning' });
- * ```
- *
- * @param message The message to show.
- * @param options The dialog's options. If a string, it represents the dialog title.
- *
- * @returns A promise resolving to a boolean indicating whether `Ok` was clicked or not.
- *
- * @since 1.0.0
- */
-async function confirm(
-  message: string,
-  options?: string | ConfirmDialogOptions
-): Promise<boolean> {
-  const opts = typeof options === 'string' ? { title: options } : options
-  return invokeTauriCommand({
-    __tauriModule: 'Dialog',
-    message: {
-      cmd: 'confirmDialog',
-      message: message.toString(),
-      title: opts?.title?.toString(),
-      type: opts?.type,
-      buttonLabels: [
-        opts?.okLabel?.toString() ?? 'Ok',
-        opts?.cancelLabel?.toString() ?? 'Cancel'
-      ]
-    }
-  })
-}
-
-export type {
-  DialogFilter,
-  OpenDialogOptions,
-  SaveDialogOptions,
-  MessageDialogOptions,
-  ConfirmDialogOptions
-}
-
-export { open, save, message, ask, confirm }

+ 0 - 2
tooling/api/src/index.ts

@@ -14,7 +14,6 @@
  */
 
 import * as app from './app'
-import * as dialog from './dialog'
 import * as event from './event'
 import * as http from './http'
 import * as notification from './notification'
@@ -32,7 +31,6 @@ const invoke = tauri.invoke
 export {
   invoke,
   app,
-  dialog,
   event,
   http,
   notification,

+ 0 - 2
tooling/bundler/src/bundle/settings.rs

@@ -141,8 +141,6 @@ pub struct UpdaterSettings {
   pub endpoints: Option<Vec<String>>,
   /// Signature public key.
   pub pubkey: String,
-  /// Display built-in dialog or use event system if disabled.
-  pub dialog: bool,
   /// Args to pass to `msiexec.exe` to run the updater on Windows.
   pub msiexec_args: Option<&'static [&'static str]>,
 }

+ 0 - 7
tooling/cli/schema.json

@@ -172,7 +172,6 @@
         },
         "updater": {
           "active": false,
-          "dialog": true,
           "pubkey": "",
           "windows": {
             "installMode": "passive",
@@ -426,7 +425,6 @@
           "description": "The updater configuration.",
           "default": {
             "active": false,
-            "dialog": true,
             "pubkey": "",
             "windows": {
               "installMode": "passive",
@@ -2476,11 +2474,6 @@
           "default": false,
           "type": "boolean"
         },
-        "dialog": {
-          "description": "Display built-in dialog or use event system if disabled.",
-          "default": true,
-          "type": "boolean"
-        },
         "endpoints": {
           "description": "The updater endpoints. TLS is enforced on production.\n\nThe updater URL can contain the following variables: - {{current_version}}: The version of the app that is requesting the update - {{target}}: The operating system name (one of `linux`, `windows` or `darwin`). - {{arch}}: The architecture of the machine (one of `x86_64`, `i686`, `aarch64` or `armv7`).\n\n# Examples - \"https://my.cdn.com/latest.json\": a raw JSON endpoint that returns the latest version and download links for each platform. - \"https://updates.app.dev/{{target}}?version={{current_version}}&arch={{arch}}\": a dedicated API with positional and query string arguments.",
           "type": [

+ 0 - 3
tooling/cli/src/interface/rust.rs

@@ -1160,9 +1160,6 @@ fn tauri_config_to_bundle_settings(
     },
     updater: Some(UpdaterSettings {
       active: updater_config.active,
-      // we set it to true by default we shouldn't have to use
-      // unwrap_or as we have a default value but used to prevent any failing
-      dialog: updater_config.dialog,
       pubkey: updater_config.pubkey,
       endpoints: updater_config
         .endpoints

部分文件因为文件数量过多而无法显示