diff --git a/capacitor.config.ts b/capacitor.config.ts index 4010ce7e..f35cbcf1 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -5,12 +5,13 @@ const config: CapacitorConfig = { appName: 'Minder', webDir: 'dist', server: { - allowNavigation: ["erudition.github.io", "localhost"], - url: "https://erudition.github.io/minder-preview/Erudition/Minder/branch/master/", + allowNavigation: ["erudition.github.io", "localhost"], // don't add "localhost" here + // url: "https://localhost/", // default is https://localhost, but setting this to ANYTHING prevent navigation to localhost... + //url: "https://erudition.github.io/minder-preview/Erudition/Minder/branch/master/", hostname: 'localhost', androidScheme: 'https', cleartext: true, - errorPath: "error.html", + //errorPath: "error.html", }, plugins: { SplashScreen: { diff --git a/elm/Main.elm b/elm/Main.elm index 12089ab9..4700fd4d 100644 --- a/elm/Main.elm +++ b/elm/Main.elm @@ -510,7 +510,8 @@ globalLayout model replica innerStuff = ] , menuItemHref "Test Marvin Sync" "sync-outline" "?sync=marvin" , menuItemHref "Reload App" "sync-outline" "index.html" - , menuItemHref "Installed branch" "sync-outline" "https://localhost/index.html" + , menuItemHref "Installed branch" "sync-outline" "https://localhost/fallback.html" + , menuItemHref "Redirect" "sync-outline" "https://localhost/" , menuItemHref "Master branch" "sync-outline" "https://erudition.github.io/minder-preview/Erudition/Minder/branch/master/" , Ion.Item.item [ Ion.Item.button, HE.onClick ClearPreferences, Ion.Item.detail False ] [ Ion.Item.label [] [ H.text "Switch Account" ] diff --git a/package.json b/package.json index c19ee281..dfbf68e2 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "build": "tsc && vite build", "build-ci": "vite build", "build-sync": "vite build && cap sync", - "patch-elm": "rm -rf ~/.elm/0.19.1/packages/ && elm make --output=www/elm-gui.js elm/Main.elm && make --directory ./elm-patches && rm -rf elm-stuff" + "patch-elm": "rm -rf ~/.elm/0.19.1/packages/ && elm make --output=www/elm-gui.js elm/Main.elm && make --directory ./elm-patches && rm -rf elm-stuff", + "capacitor:copy:after": "if [ $CAPACITOR_PLATFORM_NAME == 'web' ]; then echo leaving index in place for web. ; else echo replacing index with go-online... && mv android/app/src/main/assets/public/index.html android/app/src/main/assets/public/fallback.html && mv android/app/src/main/assets/public/go-online.html android/app/src/main/assets/public/index.html; fi" }, "repository": { "type": "git", diff --git a/vite.config.ts b/vite.config.ts index 2dc276b0..9dcb35fd 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -12,8 +12,8 @@ export default defineConfig({ //devOptions: {enabled: true}, includeAssets: ['favicon.ico', 'apple-touch-icon.png', 'masked-icon.svg'], workbox: { - navigateFallbackDenylist: [/.js/], - globPatterns: ['**/*.{css,ico,png,svg}'] // TODO removed js so capacitor plugins can work + //navigateFallbackDenylist: [/.js/], + globPatterns: ['**/*.{html,css,ico,png,svg}'] // TODO removed js so capacitor plugins can work }, outDir: "../dist", // weird it's not default, it looks for webapp files to cache here manifest: { diff --git a/www/index.ts b/www/index.ts index 68ff0cde..67a78497 100644 --- a/www/index.ts +++ b/www/index.ts @@ -118,7 +118,7 @@ function elmStarted(app) { App.addListener('appStateChange', ({ isActive }) => { detectDarkMode(); - Toast.show({ text: ("App became " + isActive ? "active!" : "inactive."), duration: "short"}).then(); + Toast.show({ text: ("App became " + (isActive ? "active!" : "inactive.")), duration: "short"}).then(); }); App.addListener('appUrlOpen', data => { @@ -134,7 +134,7 @@ function elmStarted(app) { console.log('App opened with URL: ' + url); }; - + Toast.show({ text: window.location.href, duration: "short"}).then(); try { attachOrbit(app); } catch (problemWithOrbit) diff --git a/www/vite-extra-assets/go-online.html b/www/vite-extra-assets/go-online.html new file mode 100644 index 00000000..3b468af5 --- /dev/null +++ b/www/vite-extra-assets/go-online.html @@ -0,0 +1,11 @@ + +
+