From c9a68e60e1453b2cf5634eac732fbf7123aaf92f Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Fri, 14 Apr 2023 08:13:40 -0300 Subject: [PATCH] lint --- plugins/dialog/ios/Sources/DialogPlugin.swift | 6 ++++-- plugins/dialog/src/commands.rs | 4 ++++ plugins/dialog/src/lib.rs | 1 + plugins/dialog/src/mobile.rs | 4 +--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/dialog/ios/Sources/DialogPlugin.swift b/plugins/dialog/ios/Sources/DialogPlugin.swift index 76fb9a8f..dd0756b3 100644 --- a/plugins/dialog/ios/Sources/DialogPlugin.swift +++ b/plugins/dialog/ios/Sources/DialogPlugin.swift @@ -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 ]) })) diff --git a/plugins/dialog/src/commands.rs b/plugins/dialog/src/commands.rs index ad008460..bc68f39e 100644 --- a/plugins/dialog/src/commands.rs +++ b/plugins/dialog/src/commands.rs @@ -12,7 +12,9 @@ use crate::{Dialog, FileDialogBuilder, FileResponse, MessageDialogKind, Result}; #[derive(Serialize)] #[serde(untagged)] pub enum OpenResponse { + #[cfg(desktop)] Folders(Option>), + #[cfg(desktop)] Folder(Option), Files(Option>), File(Option), @@ -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, diff --git a/plugins/dialog/src/lib.rs b/plugins/dialog/src/lib.rs index a0d4ba15..93969d71 100644 --- a/plugins/dialog/src/lib.rs +++ b/plugins/dialog/src/lib.rs @@ -206,6 +206,7 @@ pub struct FileResponse { } impl FileResponse { + #[cfg(desktop)] fn new(path: PathBuf) -> Self { Self { base64_data: None, diff --git a/plugins/dialog/src/mobile.rs b/plugins/dialog/src/mobile.rs index 6fbf56c8..289cbb7e 100644 --- a/plugins/dialog/src/mobile.rs +++ b/plugins/dialog/src/mobile.rs @@ -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>) + Send + 'sta #[derive(Debug, Deserialize)] struct ShowMessageDialogResponse { - #[serde(default)] + #[allow(dead_code)] cancelled: bool, value: bool, }