local storage: better permissions handling

This commit is contained in:
wea_ondara
2023-10-06 19:47:23 +02:00
parent baea085def
commit 91179a2794
3 changed files with 15 additions and 5 deletions

View File

@@ -6,9 +6,9 @@ import {toast} from 'vue3-toastify';
export default class StoragePersist extends Vue { export default class StoragePersist extends Vue {
async mounted(): Promise<void> { async mounted(): Promise<void> {
if (!navigator.storage) { if (!navigator.storage) {
toast.error(this.$t('localStoragePersistNotSupported'), {autoClose: false, theme: 'colored'}); toast.error(this.$t('localStorage.notSupported'));
} else { } else if (!await navigator.storage.persist()) {
await navigator.storage.persist(); toast.warning(this.$t('localStorage.persistent.notSupported'));
} }
} }
} }

View File

@@ -16,7 +16,12 @@ export const messagesDe = {
}, },
locale: 'Sprache', locale: 'Sprache',
locales: messagesEn.locales, locales: messagesEn.locales,
localStoragePersistNotSupported: 'Lokaler Speicher wird nicht permanent. Das könnte in längere Wartezeiten verursachen!', localStorage: {
notSupported: 'Lokaler Speicher wird nicht unterstützt. Diese Anwendung funktioniert möglicherweise nicht!',
persistent: {
notSupported: 'Lokaler Speicher wird nicht persistent. Das könnte in längere Wartezeiten verursachen!',
},
},
manga: { manga: {
chapters: { chapters: {
newCount: '#Neue Kapitel', newCount: '#Neue Kapitel',

View File

@@ -17,7 +17,12 @@ export const messagesEn = {
'de': 'Deutsch', 'de': 'Deutsch',
'en': 'English', 'en': 'English',
}, },
localStoragePersistNotSupported: 'Local storage will not be persisted. This could result in longer loading times!', localStorage: {
notSupported: 'Local storage is not supported. The application will probably not work!',
persistent: {
notSupported: 'Local storage will not be persisted. This could result in longer loading times!',
},
},
manga: { manga: {
chapters: { chapters: {
newCount: '#new chapters', newCount: '#new chapters',