'use strict'; const MANIFEST = 'flutter-app-manifest'; const TEMP = 'flutter-temp-cache'; const CACHE_NAME = 'flutter-app-cache'; const RESOURCES = { "assets/AssetManifest.json": "d4a84352f999f80ed4ade604f5362483", "assets/FontManifest.json": "4b7a15aa76d4082cb708323f85c4e208", "assets/fonts/Eras-BOLD-ITC.ttf": "2e8d0e1501575e1b7f1992c19ef9a8cd", "assets/fonts/Eras-DEMI-ITC.ttf": "9f7891f4f192f1e8360990fadccccafb", "assets/fonts/Eras-LIGHT-ITC.ttf": "7a959bdee9e87a5439b915faead1c476", "assets/fonts/Eras-MEDIUM-ITC.ttf": "00c37a78f957ab5b14c2c7aabddace19", "assets/fonts/gozap_icons.ttf": "720691457b1c84a823ae5141c32a6ca0", "assets/fonts/MaterialIcons-Regular.otf": "95db9098c58fd6db106f1116bae85a0b", "assets/NOTICES": "ccc5e80fe83e53ca211e7c856d613d00", "assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "6d342eb68f170c97609e9da345464e5e", "assets/packages/gozap_package/assets/images/bg/gozap_large_banner.png": "d270797b596a16db7b11ffd8e3c63e17", "assets/packages/gozap_package/assets/images/bg/gozap_small_banner.png": "807041b9a909aed779248920b07ab684", "assets/packages/gozap_package/assets/images/logos/gofuel_logo.jpeg": "9420a633092b7f2b037b63b267e8516b", "assets/packages/gozap_package/assets/images/logos/gozap_large_white_logo.png": "58058340a5f34fc1d20f1eafc7adf9d5", "assets/packages/gozap_package/assets/images/logos/gozap_smaill_white_bg_logo.png": "90fc96bff9939c43ddfcd798031138fe", "assets/packages/gozap_package/assets/images/logos/gozap_small_color_logo.png": "48c88184ea5343e55b3109c7b2790f39", "assets/packages/gozap_package/assets/images/personal_info_profile.png": "babcac7192f46dd1c2fc42d852dc5d2c", "assets/packages/gozap_package/assets/json/countries.json": "3476a68d983d25ba5f17a1a4075fbeaa", "assets/packages/gozap_package/assets/locale/data.json": "4aab15bc3e4076bceea13e34d3f1ec18", "assets/packages/gozap_package/assets/locale/localization_en.json": "4d5feb3245324c4e9aa1f4c0f4eebcf2", "assets/packages/gozap_package/assets/lottie/logged_in_lottie.json": "284cd90a83e8909acb41ec804b1bc770", "assets/packages/gozap_package/assets/lottie/recharged_lottie.json": "232e8445268210a574d613f61a40beda", "assets/packages/gozap_package/assets/lottie/registered_lottie.json": "cb41def8492745f6da17aa174f24bc18", "assets/packages/gozap_package/fonts/gozap_icons.ttf": "e84cab828b7f01dc47d1e0dd7385a99b", "assets/packages/gozap_package/fonts/icomoon.ttf": "5748b712ce11ab7faa5431d9ed5bcdc4", "assets/packages/toast/assets/toastify.css": "a85675050054f179444bc5ad70ffc635", "assets/packages/toast/assets/toastify.js": "e7006a0a033d834ef9414d48db3be6fc", "assets/shaders/ink_sparkle.frag": "ae6c1fd6f6ee6ee952cde379095a8f3f", "favicon.png": "5dcef449791fa27946b3d35ad8803796", "icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1", "icons/Icon-512.png": "96e752610906ba2a93c65f8abe1645f1", "icons/Icon-maskable-192.png": "c457ef57daa1d16f64b27b786ec2ea3c", "icons/Icon-maskable-512.png": "301a7604d45b3e739efc881eb04896ea", "index.html": "e1e437e78fcf2b36080a55f623ddc149", "/": "e1e437e78fcf2b36080a55f623ddc149", "main.dart.js": "db2f0a6319b8587b4e12cf7f07124660", "manifest.json": "ab99c3f1ff8f1deab9f82a080776e4e2", "version.json": "7d4cf7885cb246fa8c9f282dcbd4e21c" }; // The application shell files that are downloaded before a service worker can // start. const CORE = [ "main.dart.js", "index.html", "assets/AssetManifest.json", "assets/FontManifest.json"]; // During install, the TEMP cache is populated with the application shell files. self.addEventListener("install", (event) => { self.skipWaiting(); return event.waitUntil( caches.open(TEMP).then((cache) => { return cache.addAll( CORE.map((value) => new Request(value, {'cache': 'reload'}))); }) ); }); // During activate, the cache is populated with the temp files downloaded in // install. If this service worker is upgrading from one with a saved // MANIFEST, then use this to retain unchanged resource files. self.addEventListener("activate", function(event) { return event.waitUntil(async function() { try { var contentCache = await caches.open(CACHE_NAME); var tempCache = await caches.open(TEMP); var manifestCache = await caches.open(MANIFEST); var manifest = await manifestCache.match('manifest'); // When there is no prior manifest, clear the entire cache. if (!manifest) { await caches.delete(CACHE_NAME); contentCache = await caches.open(CACHE_NAME); for (var request of await tempCache.keys()) { var response = await tempCache.match(request); await contentCache.put(request, response); } await caches.delete(TEMP); // Save the manifest to make future upgrades efficient. await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES))); return; } var oldManifest = await manifest.json(); var origin = self.location.origin; for (var request of await contentCache.keys()) { var key = request.url.substring(origin.length + 1); if (key == "") { key = "/"; } // If a resource from the old manifest is not in the new cache, or if // the MD5 sum has changed, delete it. Otherwise the resource is left // in the cache and can be reused by the new service worker. if (!RESOURCES[key] || RESOURCES[key] != oldManifest[key]) { await contentCache.delete(request); } } // Populate the cache with the app shell TEMP files, potentially overwriting // cache files preserved above. for (var request of await tempCache.keys()) { var response = await tempCache.match(request); await contentCache.put(request, response); } await caches.delete(TEMP); // Save the manifest to make future upgrades efficient. await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES))); return; } catch (err) { // On an unhandled exception the state of the cache cannot be guaranteed. console.error('Failed to upgrade service worker: ' + err); await caches.delete(CACHE_NAME); await caches.delete(TEMP); await caches.delete(MANIFEST); } }()); }); // The fetch handler redirects requests for RESOURCE files to the service // worker cache. self.addEventListener("fetch", (event) => { if (event.request.method !== 'GET') { return; } var origin = self.location.origin; var key = event.request.url.substring(origin.length + 1); // Redirect URLs to the index.html if (key.indexOf('?v=') != -1) { key = key.split('?v=')[0]; } if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') { key = '/'; } // If the URL is not the RESOURCE list then return to signal that the // browser should take over. if (!RESOURCES[key]) { return; } // If the URL is the index.html, perform an online-first request. if (key == '/') { return onlineFirst(event); } event.respondWith(caches.open(CACHE_NAME) .then((cache) => { return cache.match(event.request).then((response) => { // Either respond with the cached resource, or perform a fetch and // lazily populate the cache only if the resource was successfully fetched. return response || fetch(event.request).then((response) => { if (response && Boolean(response.ok)) { cache.put(event.request, response.clone()); } return response; }); }) }) ); }); self.addEventListener('message', (event) => { // SkipWaiting can be used to immediately activate a waiting service worker. // This will also require a page refresh triggered by the main worker. if (event.data === 'skipWaiting') { self.skipWaiting(); return; } if (event.data === 'downloadOffline') { downloadOffline(); return; } }); // Download offline will check the RESOURCES for all files not in the cache // and populate them. async function downloadOffline() { var resources = []; var contentCache = await caches.open(CACHE_NAME); var currentContent = {}; for (var request of await contentCache.keys()) { var key = request.url.substring(origin.length + 1); if (key == "") { key = "/"; } currentContent[key] = true; } for (var resourceKey of Object.keys(RESOURCES)) { if (!currentContent[resourceKey]) { resources.push(resourceKey); } } return contentCache.addAll(resources); } // Attempt to download the resource online before falling back to // the offline cache. function onlineFirst(event) { return event.respondWith( fetch(event.request).then((response) => { return caches.open(CACHE_NAME).then((cache) => { cache.put(event.request, response.clone()); return response; }); }).catch((error) => { return caches.open(CACHE_NAME).then((cache) => { return cache.match(event.request).then((response) => { if (response != null) { return response; } throw error; }); }); }) ); }