Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/extension/src/components/App.js
Show First 20 Lines • Show All 427 Lines • ▼ Show 20 Lines | const handleRejectedAddressShare = () => { | ||||
url: addressRequestTabUrl, | url: addressRequestTabUrl, | ||||
tabId: addressRequestTabId, | tabId: addressRequestTabId, | ||||
}); | }); | ||||
setShowApproveAddressShareModal(false); | setShowApproveAddressShareModal(false); | ||||
// Close the popup after user action | // Close the popup after user action | ||||
window.close(); | window.close(); | ||||
}; | }; | ||||
const checkForPersistentStorage = async () => { | |||||
// Request persistent storage for site | |||||
if (navigator.storage && navigator.storage.persist) { | |||||
// Check if storage is persistent | |||||
const isPersisted = await navigator.storage.persisted(); | |||||
console.log(`Persisted storage status: ${isPersisted}`); | |||||
// If not, request persistent storage | |||||
if (!isPersisted) { | |||||
console.log(`Requesting persistent storage`); | |||||
const persistanceRequestResult = | |||||
await navigator.storage.persist(); | |||||
console.log( | |||||
`Persistent storage granted: ${persistanceRequestResult}`, | |||||
); | |||||
} | |||||
} | |||||
}; | |||||
useEffect(() => { | useEffect(() => { | ||||
copyAddressToExtensionStorage(wallet); | copyAddressToExtensionStorage(wallet); | ||||
}, [wallet]); | }, [wallet]); | ||||
useEffect(() => { | useEffect(() => { | ||||
// On load useEffect() block | |||||
// Check for peristent storage | |||||
checkForPersistentStorage(); | |||||
// Parse for query string asking for user approval of sharing extension info with a web page | // Parse for query string asking for user approval of sharing extension info with a web page | ||||
// Do not set txInfo in state if query strings are not present | // Do not set txInfo in state if query strings are not present | ||||
if ( | if ( | ||||
!window.location || | !window.location || | ||||
!window.location.hash || | !window.location.hash || | ||||
window.location.hash === '#/wallet' | window.location.hash === '#/wallet' | ||||
) { | ) { | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 194 Lines • Show Last 20 Lines |