Skip to content

Commit c8ab743

Browse files
committed
feat: change params
1 parent e60ce03 commit c8ab743

File tree

4 files changed

+19
-22
lines changed

4 files changed

+19
-22
lines changed

plugins/dialog/src/commands.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use tauri::{command, Manager, Runtime, State, Window};
99
use tauri_plugin_fs::FsExt;
1010

1111
use crate::{
12-
Dialog, FileDialogBuilder, FilePath, MessageDialogButtons, MessageDialogKind, Result,
13-
DestroyPathOptions, CANCEL, NO, OK, YES,
12+
Dialog, FileDialogBuilder, FilePath, MessageDialogButtons, MessageDialogKind, Result, CANCEL,
13+
NO, OK, YES,
1414
};
1515

1616
#[derive(Serialize)]
@@ -242,7 +242,7 @@ pub(crate) async fn save<R: Runtime>(
242242
}
243243

244244
#[command]
245-
pub fn destroy_path(_p: DestroyPathOptions) -> bool {
245+
pub fn destroy_path(_path: String) -> bool {
246246
true
247247
}
248248

plugins/dialog/src/desktop.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rfd::{AsyncFileDialog, AsyncMessageDialog};
1313
use serde::de::DeserializeOwned;
1414
use tauri::{plugin::PluginApi, AppHandle, Runtime};
1515

16-
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder, DestroyPathOptions, OK};
16+
use crate::{models::*, FileDialogBuilder, FilePath, MessageDialogBuilder, OK};
1717

1818
pub fn init<R: Runtime, C: DeserializeOwned>(
1919
app: &AppHandle<R>,
@@ -207,10 +207,7 @@ pub fn save_file<R: Runtime, F: FnOnce(Option<FilePath>) + Send + 'static>(
207207
});
208208
}
209209

210-
pub fn destroy_path<R: Runtime>(
211-
_dialog: FileDialogBuilder<R>,
212-
_p: DestroyPathOptions,
213-
) -> bool {
210+
pub fn destroy_path<R: Runtime>(_dialog: FileDialogBuilder<R>, _path: String) -> bool {
214211
true
215212
}
216213

plugins/dialog/src/lib.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/app-icon.png"
1010
)]
1111

12-
use serde::{Deserialize, Serialize};
12+
use serde::Serialize;
1313
use tauri::{
1414
plugin::{Builder, TauriPlugin},
1515
Manager, Runtime,
@@ -338,11 +338,6 @@ pub(crate) struct FileDialogPayload<'a> {
338338
multiple: bool,
339339
}
340340

341-
#[derive(Debug, Serialize, Deserialize)]
342-
pub struct DestroyPathOptions {
343-
path: FilePath,
344-
}
345-
346341
// raw window handle :(
347342
unsafe impl<R: Runtime> Send for FileDialogBuilder<R> {}
348343

@@ -573,8 +568,8 @@ impl<R: Runtime> FileDialogBuilder<R> {
573568
save_file(self, f)
574569
}
575570

576-
pub fn destroy_path(self, p: DestroyPathOptions) -> bool {
577-
destroy_path(self, p)
571+
pub fn destroy_path(self, path: String) -> bool {
572+
destroy_path(self, path)
578573
}
579574
}
580575

@@ -689,7 +684,7 @@ impl<R: Runtime> FileDialogBuilder<R> {
689684
blocking_fn!(self, save_file)
690685
}
691686

692-
pub fn blocking_destroy_path(self, p: DestroyPathOptions) -> bool {
693-
self.destroy_path(p)
687+
pub fn blocking_destroy_path(self, path: String) -> bool {
688+
self.destroy_path(path)
694689
}
695690
}

plugins/dialog/src/mobile.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5-
use serde::{de::DeserializeOwned, Deserialize};
5+
use serde::{de::DeserializeOwned, Serialize, Deserialize};
66
use tauri::{
77
plugin::{PluginApi, PluginHandle},
88
AppHandle, Runtime,
99
};
1010

11-
use crate::{FileDialogBuilder, FilePath, MessageDialogBuilder, DestroyPathOptions};
11+
use crate::{FileDialogBuilder, FilePath, MessageDialogBuilder};
1212

1313
#[cfg(target_os = "android")]
1414
const PLUGIN_IDENTIFIER: &str = "app.tauri.dialog";
@@ -105,14 +105,19 @@ pub fn save_file<R: Runtime, F: FnOnce(Option<FilePath>) + Send + 'static>(
105105
});
106106
}
107107

108+
#[derive(Debug, Serialize, Deserialize)]
109+
pub struct DestroyPathOptions {
110+
path: String,
111+
}
112+
108113
#[allow(unused_variables)]
109-
pub fn destroy_path<R: Runtime>(dialog: FileDialogBuilder<R>, p: DestroyPathOptions) -> bool {
114+
pub fn destroy_path<R: Runtime>(dialog: FileDialogBuilder<R>, path: String) -> bool {
110115
#[cfg(target_os = "ios")]
111116
{
112117
let res = dialog
113118
.dialog
114119
.0
115-
.run_mobile_plugin::<()>("stopAccessingPath", p);
120+
.run_mobile_plugin::<()>("stopAccessingPath", DestroyPathOptions { path });
116121

117122
if res.is_err() {
118123
return false;

0 commit comments

Comments
 (0)