Skip to content

Commit

Permalink
refactor(core): move dialog API to its own plugin (#6717)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Apr 19, 2023
1 parent 3f17ee8 commit 2d5378b
Show file tree
Hide file tree
Showing 28 changed files with 117 additions and 1,838 deletions.
5 changes: 5 additions & 0 deletions .changes/bundler-remove-dialog-option.md
@@ -0,0 +1,5 @@
---
"tauri-bundler": patch
---

Removed the `UpdaterSettings::dialog` field.
6 changes: 6 additions & 0 deletions .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 changes: 6 additions & 0 deletions .changes/remove-updater-dialog.md
@@ -0,0 +1,6 @@
---
"tauri": patch
"tauri-utils": patch
---

Remove the updater's dialog option.
7 changes: 0 additions & 7 deletions core/config-schema/schema.json
Expand Up @@ -172,7 +172,6 @@
},
"updater": {
"active": false,
"dialog": true,
"pubkey": "",
"windows": {
"installMode": "passive",
Expand Down Expand Up @@ -426,7 +425,6 @@
"description": "The updater configuration.",
"default": {
"active": false,
"dialog": true,
"pubkey": "",
"windows": {
"installMode": "passive",
Expand Down Expand Up @@ -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": [
Expand Down
19 changes: 1 addition & 18 deletions core/tauri-utils/src/config.rs
Expand Up @@ -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:
Expand Down Expand Up @@ -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)]
Expand All @@ -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,
Expand All @@ -2397,7 +2391,6 @@ impl Default for UpdaterConfig {
fn default() -> Self {
Self {
active: false,
dialog: default_true(),
endpoints: None,
pubkey: "".into(),
windows: Default::default(),
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
}

Expand Down Expand Up @@ -3596,7 +3580,6 @@ mod test {
},
updater: UpdaterConfig {
active: false,
dialog: true,
pubkey: "".into(),
endpoints: None,
windows: Default::default(),
Expand Down
12 changes: 5 additions & 7 deletions core/tauri/Cargo.toml
Expand Up @@ -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]
Expand Down Expand Up @@ -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" ]
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions core/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

0 comments on commit 2d5378b

Please sign in to comment.