mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-02-07 02:51:23 +01:00
Implement Standalone Android App via Flutter WebView
- Configured `vite.config.ts` for relative base path support. - Initialized `mobile_app` Flutter project with `webview_flutter`. - Added `assets/www` to Flutter assets configuration. - Implemented `mobile_app/lib/main.dart` with WebView and Bridge API integration (Water Level Slider). - Updated `.gitignore` for Flutter artifacts. - Successfully built APK artifacts. Co-authored-by: kliffdafunkfacekilla-arch <239708976+kliffdafunkfacekilla-arch@users.noreply.github.com>
This commit is contained in:
parent
e938bc7802
commit
e62f20b0d1
808 changed files with 111592 additions and 10 deletions
98
mobile_app/assets/www/sw.js
Normal file
98
mobile_app/assets/www/sw.js
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
importScripts("https://storage.googleapis.com/workbox-cdn/releases/6.2.0/workbox-sw.js");
|
||||
|
||||
const {Route, registerRoute} = workbox.routing;
|
||||
const {CacheFirst, NetworkFirst, StaleWhileRevalidate} = workbox.strategies;
|
||||
const {CacheableResponsePlugin} = workbox.cacheableResponse;
|
||||
const {ExpirationPlugin} = workbox.expiration;
|
||||
|
||||
const DAY = 24 * 60 * 60; // in seconds
|
||||
|
||||
registerRoute(
|
||||
({request}) => request.mode === "navigate",
|
||||
new NetworkFirst({
|
||||
networkTimeoutSeconds: 15,
|
||||
cacheName: "fmg-html",
|
||||
plugins: [new CacheableResponsePlugin({statuses: [0, 200]})]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({request, url}) =>
|
||||
request.destination === "script" &&
|
||||
!url.pathname.endsWith("min.js") &&
|
||||
!url.pathname.includes("versioning.js") &&
|
||||
!url.pathname.includes("google"),
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: "fmg-scripts",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 30 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({request}) => request.destination === "style",
|
||||
new CacheFirst({
|
||||
cacheName: "fmg-stylesheets",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 30 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({request, url}) => request.destination === "script" && url.pathname.endsWith("min.js"),
|
||||
new CacheFirst({
|
||||
cacheName: "fmg-libs",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 30 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
new RegExp(".json$"),
|
||||
new CacheFirst({
|
||||
cacheName: "fmg-json",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 30 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({request}) => request.destination === "image",
|
||||
new CacheFirst({
|
||||
cacheName: "fmg-images",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 60 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
new RegExp(".svg$"),
|
||||
new CacheFirst({
|
||||
cacheName: "fmg-charges",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 60 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
|
||||
registerRoute(
|
||||
({request}) => request.destination === "font",
|
||||
new CacheFirst({
|
||||
cacheName: "fmg-fonts",
|
||||
plugins: [
|
||||
new CacheableResponsePlugin({statuses: [0, 200]}),
|
||||
new ExpirationPlugin({maxEntries: 100, maxAgeSeconds: 60 * DAY})
|
||||
]
|
||||
})
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue