pull/306/head
Lucas Nogueira 2 years ago
parent 6aaa50164c
commit c9a68e60e1
No known key found for this signature in database
GPG Key ID: 7C32FCA95C8C95D7

@ -185,12 +185,14 @@ class DialogPlugin: Plugin {
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: cancelButtonLabel, style: UIAlertAction.Style.default, handler: { (_) -> Void in
invoke.resolve([
"value": false
"value": false,
"cancelled": false
])
}))
alert.addAction(UIAlertAction(title: okButtonLabel, style: UIAlertAction.Style.default, handler: { (_) -> Void in
invoke.resolve([
"value": true
"value": true,
"cancelled": false
])
}))

@ -12,7 +12,9 @@ use crate::{Dialog, FileDialogBuilder, FileResponse, MessageDialogKind, Result};
#[derive(Serialize)]
#[serde(untagged)]
pub enum OpenResponse {
#[cfg(desktop)]
Folders(Option<Vec<PathBuf>>),
#[cfg(desktop)]
Folder(Option<PathBuf>),
Files(Option<Vec<FileResponse>>),
File(Option<FileResponse>),
@ -46,12 +48,14 @@ pub struct OpenDialogOptions {
/// 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)]
#[cfg_attr(mobile, allow(dead_code))]
recursive: bool,
}
/// The options for the save dialog API.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(mobile, allow(dead_code))]
pub struct SaveDialogOptions {
/// The title of the dialog window.
title: Option<String>,

@ -206,6 +206,7 @@ pub struct FileResponse {
}
impl FileResponse {
#[cfg(desktop)]
fn new(path: PathBuf) -> Self {
Self {
base64_data: None,

@ -2,8 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use std::path::PathBuf;
use serde::{de::DeserializeOwned, Deserialize};
use tauri::{
plugin::{PluginApi, PluginHandle},
@ -87,7 +85,7 @@ pub fn pick_files<R: Runtime, F: FnOnce(Option<Vec<FileResponse>>) + Send + 'sta
#[derive(Debug, Deserialize)]
struct ShowMessageDialogResponse {
#[serde(default)]
#[allow(dead_code)]
cancelled: bool,
value: bool,
}

Loading…
Cancel
Save