Move persistent storage init

This commit is contained in:
benthecarman
2024-06-05 15:07:45 -05:00
committed by Paul Miller
parent 318fa6f353
commit bc38a873fb
2 changed files with 20 additions and 16 deletions

View File

@@ -208,6 +208,26 @@ export const makeMegaStoreContext = () => {
console.log("No nsec stored"); 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( const success = await sw.setupMutinyWallet(
settings, settings,
password, password,

View File

@@ -97,22 +97,6 @@ export async function setupMutinyWallet(
): Promise<boolean> { ): Promise<boolean> {
console.log("Starting setup..."); 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 { const {
network, network,
proxy, proxy,