diff --git a/src/state/megaStore.tsx b/src/state/megaStore.tsx index 29fcb153..2ffa5805 100644 --- a/src/state/megaStore.tsx +++ b/src/state/megaStore.tsx @@ -208,6 +208,26 @@ export const makeMegaStoreContext = () => { console.log("No nsec stored"); } + // https://developer.mozilla.org/en-US/docs/Web/API/Storage_API + // Ask the browser to not clear storage + if (navigator.storage && navigator.storage.persist) { + navigator.storage.persist().then((persistent) => { + if (persistent) { + console.log( + "Storage will not be cleared except by explicit user action" + ); + } else { + console.log( + "Storage may be cleared by the UA under storage pressure." + ); + } + }); + } else { + console.warn( + "Persistent storage not supported, storage may be cleared by the UA under storage pressure." + ); + } + const success = await sw.setupMutinyWallet( settings, password, diff --git a/src/workers/walletWorker.ts b/src/workers/walletWorker.ts index f81291ea..8a7242a3 100644 --- a/src/workers/walletWorker.ts +++ b/src/workers/walletWorker.ts @@ -97,22 +97,6 @@ export async function setupMutinyWallet( ): Promise { console.log("Starting setup..."); - // https://developer.mozilla.org/en-US/docs/Web/API/Storage_API - // Ask the browser to not clear storage - if (navigator.storage && navigator.storage.persist) { - navigator.storage.persist().then((persistent) => { - if (persistent) { - console.log( - "Storage will not be cleared except by explicit user action" - ); - } else { - console.log( - "Storage may be cleared by the UA under storage pressure." - ); - } - }); - } - const { network, proxy,