[tauri] KeepHerSafeApps: App words for Keep her safe, and Android's own save screen through a narrow bridge
This commit is contained in:
@@ -14,7 +14,11 @@
|
||||
let refused = $state(false);
|
||||
let said = $state('');
|
||||
|
||||
const inApp = $derived(wiring.keeping.where === 'app');
|
||||
|
||||
$effect(() => {
|
||||
// In an app there is no browser to ask, and the answer would always be no (A1).
|
||||
if (inApp) return;
|
||||
wiring.keeping.persisted().then(
|
||||
(p) => (persisted = p),
|
||||
(error: unknown) => {
|
||||
@@ -38,7 +42,9 @@
|
||||
async function save(): Promise<void> {
|
||||
try {
|
||||
const file = await wiring.exportRose(currentKey);
|
||||
wiring.saveFile(`rose-${today}.json`, JSON.stringify(file, null, 1));
|
||||
said = '';
|
||||
const written = await wiring.saveFile(`rose-${today}.json`, JSON.stringify(file, null, 1));
|
||||
if (written === true) said = en.rose.safe.saved;
|
||||
} catch (error) {
|
||||
console.error('keep: the rose could not be saved to a file', error);
|
||||
}
|
||||
@@ -64,13 +70,15 @@
|
||||
|
||||
<section class="safe" aria-labelledby="{uid}-title">
|
||||
<h3 id="{uid}-title">{en.rose.safe.title}</h3>
|
||||
{#if persisted !== undefined}
|
||||
{#if inApp}
|
||||
<p>{en.rose.safe.app}</p>
|
||||
{:else if persisted !== undefined}
|
||||
<p>{refused ? en.rose.safe.refused : persisted === true ? en.rose.safe.kept : persisted === false ? en.rose.safe.mayClear : en.rose.safe.unknown}</p>
|
||||
{/if}
|
||||
{#if persisted === false && !refused}
|
||||
{#if !inApp && persisted === false && !refused}
|
||||
<button type="button" class="quiet" onclick={ask}>{en.rose.safe.ask}</button>
|
||||
{/if}
|
||||
{#if wiring.installHint}
|
||||
{#if !inApp && wiring.installHint}
|
||||
<p>{en.rose.safe.install}</p>
|
||||
{/if}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user