mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-19 19:17:15 +02:00
feat(fs): resolve content URIs on Android (#1658)
* Implemented writeTextFile on Android. * Added license headers. * fix fmt checks. * implement more file APIs * change file * cleanup * refactor dialog plugin to leverage new FS APIs * implement metadata functions * fix build * expose FS rust API * resolve resources on android * update pnpm * update docs --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
co-authored by
Lucas Nogueira
parent
3c52f30ea4
commit
448846b834
@@ -1,7 +1,6 @@
|
||||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde::{de::DeserializeOwned, Deserialize};
|
||||
use tauri::{
|
||||
@@ -9,7 +8,7 @@ use tauri::{
|
||||
AppHandle, Runtime,
|
||||
};
|
||||
|
||||
use crate::{FileDialogBuilder, FileResponse, MessageDialogBuilder};
|
||||
use crate::{FileDialogBuilder, FilePath, MessageDialogBuilder};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
const PLUGIN_IDENTIFIER: &str = "app.tauri.dialog";
|
||||
@@ -47,15 +46,15 @@ impl<R: Runtime> Dialog<R> {
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct FilePickerResponse {
|
||||
files: Vec<FileResponse>,
|
||||
files: Vec<FilePath>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct SaveFileResponse {
|
||||
file: PathBuf,
|
||||
file: FilePath,
|
||||
}
|
||||
|
||||
pub fn pick_file<R: Runtime, F: FnOnce(Option<FileResponse>) + Send + 'static>(
|
||||
pub fn pick_file<R: Runtime, F: FnOnce(Option<FilePath>) + Send + 'static>(
|
||||
dialog: FileDialogBuilder<R>,
|
||||
f: F,
|
||||
) {
|
||||
@@ -72,7 +71,7 @@ pub fn pick_file<R: Runtime, F: FnOnce(Option<FileResponse>) + Send + 'static>(
|
||||
});
|
||||
}
|
||||
|
||||
pub fn pick_files<R: Runtime, F: FnOnce(Option<Vec<FileResponse>>) + Send + 'static>(
|
||||
pub fn pick_files<R: Runtime, F: FnOnce(Option<Vec<FilePath>>) + Send + 'static>(
|
||||
dialog: FileDialogBuilder<R>,
|
||||
f: F,
|
||||
) {
|
||||
@@ -89,7 +88,7 @@ pub fn pick_files<R: Runtime, F: FnOnce(Option<Vec<FileResponse>>) + Send + 'sta
|
||||
});
|
||||
}
|
||||
|
||||
pub fn save_file<R: Runtime, F: FnOnce(Option<PathBuf>) + Send + 'static>(
|
||||
pub fn save_file<R: Runtime, F: FnOnce(Option<FilePath>) + Send + 'static>(
|
||||
dialog: FileDialogBuilder<R>,
|
||||
f: F,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user