Skip to content

Commit

Permalink
fix: ask for permissions to write on documents
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebus-84 committed Dec 17, 2024
1 parent 8ece403 commit f1f36fa
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/components/organisms/debug/DebugPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { onMount } from 'svelte';
import { getDebugMode } from '$lib/preferences/debug';
import { Capacitor } from '@capacitor/core';
import { Directory } from '@capacitor/filesystem';
import { Directory, Filesystem } from '@capacitor/filesystem';
import write_blob from 'capacitor-blob-writer';
import { m } from '$lib/i18n';
Expand All @@ -30,13 +30,15 @@
URL.revokeObjectURL(url);
return;
}
const permissions = await Filesystem.checkPermissions();
if (!permissions.publicStorage) await Filesystem.requestPermissions();
path = `${new Date().toISOString()}.txt`;
message = m.Writing();
loading = true;
const uri = await write_blob({
path,
blob,
directory: Directory.Library,
directory: Directory.Documents,
on_fallback: () => false
});
if (!uri) {
Expand Down

0 comments on commit f1f36fa

Please sign in to comment.