mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-29 12:06:01 +02:00
The Android and iOS support introduced on #1011 is not really supported - the Tauri path API correctly resolves the cache directory on mobile, and we can access those directly using Rust code. This is a breaking change because we no longer uses the same directory to store the files - app_cache_dir returns a different location
This commit is contained in:
committed by
GitHub
parent
0d5e7e2892
commit
0c040bcc9a
@@ -14,6 +14,7 @@
|
||||
import Notifications from "./views/Notifications.svelte";
|
||||
import Shortcuts from "./views/Shortcuts.svelte";
|
||||
import Shell from "./views/Shell.svelte";
|
||||
import Store from "./views/Store.svelte";
|
||||
import Updater from "./views/Updater.svelte";
|
||||
import Clipboard from "./views/Clipboard.svelte";
|
||||
import WebRTC from "./views/WebRTC.svelte";
|
||||
@@ -90,6 +91,11 @@
|
||||
component: Shell,
|
||||
icon: "i-codicon-terminal-bash",
|
||||
},
|
||||
{
|
||||
label: "Store",
|
||||
component: Store,
|
||||
icon: "i-codicon-file-code",
|
||||
},
|
||||
!isMobile && {
|
||||
label: "Updater",
|
||||
component: Updater,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
}
|
||||
|
||||
function writeToStdin() {
|
||||
child.write(stdin).catch(onMessage);
|
||||
child.write(`${stdin}\n`).catch(onMessage);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<script>
|
||||
import { Store } from "@tauri-apps/plugin-store";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
export let onMessage;
|
||||
|
||||
let key;
|
||||
let value;
|
||||
|
||||
const store = new Store("cache.json");
|
||||
let cache = {};
|
||||
|
||||
onMount(async () => {
|
||||
await store.load();
|
||||
const values = await store.entries();
|
||||
for (const [key, value] of values) {
|
||||
cache[key] = value;
|
||||
}
|
||||
cache = cache;
|
||||
});
|
||||
|
||||
function write(key, value) {
|
||||
store
|
||||
.set(key, value)
|
||||
.then(() => store.get(key))
|
||||
.then((v) => {
|
||||
cache[key] = v;
|
||||
cache = cache;
|
||||
})
|
||||
.then(() => store.save())
|
||||
.catch(onMessage);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col childre:grow gap-1">
|
||||
<div class="flex flex-col flex-row-md gap-4">
|
||||
<div class="flex items-center gap-1">
|
||||
Key:
|
||||
<input class="grow input" bind:value={key} />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-1">
|
||||
Value:
|
||||
<input class="grow input" bind:value />
|
||||
</div>
|
||||
|
||||
<button class="btn" on:click={() => write(key, value)}> Write </button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{#each Object.entries(cache) as [k, v]}
|
||||
<div>{k} = {v}</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user