Fix offline app exception handling, optimize patch
This commit is contained in:
@@ -34,7 +34,7 @@ class GlobalModel extends ChangeNotifier {
|
|||||||
} else {
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
} on SocketException catch (exce) {
|
} on (ClientException, SocketException, HttpException) catch (exce) {
|
||||||
print("Unable to download hash");
|
print("Unable to download hash");
|
||||||
print(exce);
|
print(exce);
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
--- menu/build/web/flutter_service_worker.js 2024-01-26 14:59:42.195084752 +0530
|
--- flutter_service_worker.js.orig 2024-01-27 06:21:03.225353652 +0530
|
||||||
+++ in/flutter_service_worker.pat.js 2024-01-26 15:07:37.253097455 +0530
|
+++ flutter_service_worker.js 2024-01-27 06:56:23.531689565 +0530
|
||||||
@@ -2,6 +2,7 @@
|
@@ -1,4 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
+const BaseHREF = 'HREFREPLACE';
|
||||||
const MANIFEST = 'flutter-app-manifest';
|
const MANIFEST = 'flutter-app-manifest';
|
||||||
const TEMP = 'flutter-temp-cache';
|
const TEMP = 'flutter-temp-cache';
|
||||||
const CACHE_NAME = 'flutter-app-cache';
|
const CACHE_NAME = 'flutter-app-cache';
|
||||||
+const BaseHREF = 'HREFREPLACE';
|
@@ -36,10 +37,7 @@
|
||||||
|
"version.json": "d7fbd41faace5a7a02bb5da13e6049ec"};
|
||||||
const RESOURCES = {
|
|
||||||
"version.json": "d7fbd41faace5a7a02bb5da13e6049ec",
|
|
||||||
@@ -37,10 +38,7 @@
|
|
||||||
};
|
|
||||||
// The application shell files that are downloaded before a service worker can
|
// The application shell files that are downloaded before a service worker can
|
||||||
// start.
|
// start.
|
||||||
-const CORE = ["main.dart.js",
|
-const CORE = ["main.dart.js",
|
||||||
@@ -19,28 +17,12 @@
|
|||||||
+const CORE = Object.keys(RESOURCES);
|
+const CORE = Object.keys(RESOURCES);
|
||||||
|
|
||||||
// During install, the TEMP cache is populated with the application shell files.
|
// During install, the TEMP cache is populated with the application shell files.
|
||||||
self.addEventListener("install", (event) =>
|
self.addEventListener("install", (event) => {
|
||||||
@@ -139,13 +137,30 @@
|
@@ -123,12 +121,13 @@
|
||||||
{
|
if (key.indexOf('?v=') != -1) {
|
||||||
key = key.split('?v=')[0];
|
key = key.split('?v=')[0];
|
||||||
}
|
}
|
||||||
- if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') {
|
- if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') {
|
||||||
+ if (key.endsWith("chromium/canvaskit.js"))
|
|
||||||
+ {
|
|
||||||
+ key = "canvaskit/chromium/canvaskit.js"
|
|
||||||
+ }
|
|
||||||
+ if (key.endsWith("chromium/canvaskit.wasm"))
|
|
||||||
+ {
|
|
||||||
+ key = "canvaskit/chromium/canvaskit.wasm"
|
|
||||||
+ }
|
|
||||||
+ if (key.endsWith("canvaskit.js"))
|
|
||||||
+ {
|
|
||||||
+ key = "canvaskit/canvaskit.js"
|
|
||||||
+ }
|
|
||||||
+ if (key.endsWith("canvaskit.wasm"))
|
|
||||||
+ {
|
|
||||||
+ key = "canvaskit/canvaskit.wasm"
|
|
||||||
+ }
|
|
||||||
+ if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '' || key == BaseHREF) {
|
+ if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '' || key == BaseHREF) {
|
||||||
key = '/';
|
key = '/';
|
||||||
}
|
}
|
||||||
@@ -51,3 +33,4 @@
|
|||||||
+ if (!RESOURCES[resKey]) {
|
+ if (!RESOURCES[resKey]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// If the URL is the index.html, perform an online-first request.
|
||||||
|
|||||||
Reference in New Issue
Block a user