diff --git a/metro.config.js b/metro.config.js index fb497c1..d355971 100644 --- a/metro.config.js +++ b/metro.config.js @@ -9,8 +9,8 @@ module.exports = { resolver: { ...config.resolver, extraNodeModules: { - ...config.resolver.extraNodeModules, stream: require.resolve('react-native-stream'), + ...config.resolver.extraNodeModules, }, }, }; diff --git a/public/manifest.json b/public/manifest.json index 2dca273..6c0d3d6 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -14,8 +14,9 @@ "type": "image/png" } ], - "start_url": ".", - "display": "standalone", + "id": "/?source=pwa", + "start_url": "/?source=pwa", + "display": "fullscreen", "theme_color": "pink", "background_color": "pink" - } \ No newline at end of file +} \ No newline at end of file diff --git a/src/utils/config.ts b/src/utils/config.ts index ac481e3..24360f0 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -429,7 +429,8 @@ export const saveStorage: ( }; const _saveStorage = async (slot: string, val: string): Promise => { - // cookies are forever Mostly so priavte keys dont get deleted. here bc gets hoisted anywauy + // cookies are forever Mostly so priavte keys dont get deleted. here bc gets hoisted anyway + // TODO chrome lets max 400 dahs. add in getStorage() or somewhere if timeLeft < 30 days -> reset cookie val const expirationDate = new Date(2100, 0, 1).toUTCString(); switch (Platform.OS) { case 'web': diff --git a/src/utils/serviceWorkerRegistration.js b/src/utils/serviceWorkerRegistration.js index 35dedc3..c38a99f 100644 --- a/src/utils/serviceWorkerRegistration.js +++ b/src/utils/serviceWorkerRegistration.js @@ -20,10 +20,7 @@ const isLocalhost = Boolean( ); export function register(config) { - if ( - // process.env.NODE_ENV === 'production' && - 'serviceWorker' in navigator - ) { + if (process.env.NODE_ENV !== 'test' && 'serviceWorker' in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); if (publicUrl.origin !== window.location.origin) { @@ -33,9 +30,9 @@ export function register(config) { return; } - const url = process.env.PUBLIC_URL || `http://${window.location.host}`; + const scheme = window.location.hostname === 'localhost' ? 'http' : 'https'; window.addEventListener('load', () => { - const swUrl = `${url}/service-worker.js`; + const swUrl = `${scheme}://${window.location.host}/service-worker.js`; console.log('service worker url', url, swUrl); if (isLocalhost) {