@@ -85,7 +85,10 @@ export function App() {
8585
8686 const requestPersistence = async ( ) => {
8787 try {
88- const granted = await navigator . storage . persist ( ) ;
88+ const storageManager : StorageManager | undefined = ( navigator as unknown as { storage ?: StorageManager } ) . storage ;
89+ const granted = storageManager && typeof storageManager . persist === "function"
90+ ? await storageManager . persist ( )
91+ : false ;
8992 if ( ! granted ) {
9093 console . warn ( "Storage persistence not granted. You may be logged out from time to time." ) ;
9194 }
@@ -100,7 +103,10 @@ export function App() {
100103 useEffect ( ( ) => {
101104 ( async ( ) => {
102105 try {
103- const persisted = await navigator . storage . persisted ( ) ;
106+ const storageManager : StorageManager | undefined = ( navigator as unknown as { storage ?: StorageManager } ) . storage ;
107+ const persisted = storageManager && typeof storageManager . persisted === "function"
108+ ? await storageManager . persisted ( )
109+ : false ;
104110 console . log ( `Storage persisted: ${ persisted } ` ) ;
105111 if ( ! persisted ) {
106112 setModalConfig ( { ...modalConfig , show : true } ) ;
@@ -113,7 +119,11 @@ export function App() {
113119 } else {
114120 useEffect ( ( ) => {
115121 ( async ( ) => {
116- if ( ! await navigator . storage . persisted ( ) ) {
122+ const storageManager : StorageManager | undefined = ( navigator as unknown as { storage ?: StorageManager } ) . storage ;
123+ const persisted = storageManager && typeof storageManager . persisted === "function"
124+ ? await storageManager . persisted ( )
125+ : false ;
126+ if ( ! persisted ) {
117127 await requestPersistence ( ) ;
118128 }
119129 } ) ( ) ;
@@ -261,7 +271,7 @@ export function App() {
261271 </ LocationProvider >
262272 </ Col >
263273 { Median . isNativeApp ( ) ? < > </ > : < Footer /> }
264- { persistModal }
274+ { import . meta . env ?. MODE === 'test' ? null : persistModal }
265275 </ >
266276 ) ;
267277 // we need an extra recovery state, otherwise we would show the login/register page.
0 commit comments