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:
mikoto2000
2024-08-24 01:35:53 +09:00
committed by GitHub
parent 3c52f30ea4
commit 448846b834
38 changed files with 1951 additions and 820 deletions
+7 -8
View File
@@ -23,11 +23,7 @@
async function prompt() {
confirm("Do you want to do something?")
.then((res) =>
onMessage(
res ? "Yes" : "No"
)
)
.then((res) => onMessage(res ? "Yes" : "No"))
.catch(onMessage);
}
@@ -67,14 +63,15 @@
if (Array.isArray(res)) {
onMessage(res);
} else {
var pathToRead = typeof res === "string" ? res : res.path;
var pathToRead = res;
var isFile = pathToRead.match(/\S+\.\S+$/g);
readFile(pathToRead)
.then(function (response) {
if (isFile) {
if (
pathToRead.includes(".png") ||
pathToRead.includes(".jpg")
pathToRead.includes(".jpg") ||
pathToRead.includes(".jpeg")
) {
arrayBufferToBase64(
new Uint8Array(response),
@@ -144,5 +141,7 @@
>Open save dialog</button
>
<button class="btn" id="prompt-dialog" on:click={prompt}>Prompt</button>
<button class="btn" id="custom-prompt-dialog" on:click={promptCustom}>Prompt (custom)</button>
<button class="btn" id="custom-prompt-dialog" on:click={promptCustom}
>Prompt (custom)</button
>
<button class="btn" id="message-dialog" on:click={msg}>Message</button>