Skip to content

Commit

Permalink
Deploying to gh-pages from @ cf77533 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
dchristl committed Aug 24, 2024
1 parent 9bb2067 commit 9b8e908
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 71 deletions.
2 changes: 1 addition & 1 deletion flutter_bootstrap.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions flutter_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ const RESOURCES = {"icons/Icon-maskable-512.png": "b244236885291fe92013e71b0dc3a
"assets/packages/flutter_map/lib/assets/flutter_map_logo.png": "208d63cc917af9713fc9572bd5c09362",
"assets/AssetManifest.json": "a6675de9d99a6b788f50baeb9fd1410e",
"assets/NOTICES": "396164cb5369541c25cf550c9c488c20",
"index.html": "e0e8afcc1cfe7a030986c517528aaee2",
"/": "e0e8afcc1cfe7a030986c517528aaee2",
"index.html": "04b14b29f7060b9acb30e28d3dc5b72d",
"/": "04b14b29f7060b9acb30e28d3dc5b72d",
"main.dart.js": "8a72fc09ff7d6e44a6cd12c980d8f083",
"favicon.png": "b1213d4ae286a5ad2933d5f82e69e85b",
"version.json": "956096f59fd7f705dfecfd2afa9b75b4",
"flutter_bootstrap.js": "d3cd13d0f8d97a3cd5038884090d74b4",
"flutter_bootstrap.js": "3fbcaa2ad345a18bb87a586daa821bf4",
"canvaskit/skwasm.js.symbols": "262f4827a1317abb59d71d6c587a93e2",
"canvaskit/skwasm.wasm": "9f0c0c02b82a910d12ce0543ec130e60",
"canvaskit/chromium/canvaskit.wasm": "b1ac05b29c127d86df4bcfbf50dd902a",
Expand All @@ -32,7 +32,7 @@ const RESOURCES = {"icons/Icon-maskable-512.png": "b244236885291fe92013e71b0dc3a
"canvaskit/canvaskit.js": "66177750aff65a66cb07bb44b8c6422b",
"canvaskit/skwasm.worker.js": "89990e8c92bcb123999aa81f7e203b1c",
"canvaskit/skwasm.js": "694fda5704053957c2594de355805228",
"manifest.json": "8d28e99149c78ce99037cc8e61446753",
"manifest.json": "27b75b38b4b8143e79888a41de4c51ce",
"flutter.js": "f393d3c16b631f36852323de8e583132"};
// The application shell files that are downloaded before a service worker can
// start.
Expand Down
83 changes: 19 additions & 64 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,80 +23,35 @@
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="openhaystack_mobile">
<meta name="apple-mobile-web-app-title" content="macless_haystack">
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<title>Macless Haystack</title>
<link rel="icon" href="favicon.png">
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = "1466793393";
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
const serviceWorkerVersion = "1242797551";
var scriptLoaded = false;
function loadMainDartJs() {
if (scriptLoaded) {
return;
}
scriptLoaded = true;
var scriptTag = document.createElement('script');
scriptTag.src = 'main.dart.js';
scriptTag.type = 'application/javascript';
document.body.append(scriptTag);
}

if ('serviceWorker' in navigator) {
// Service workers are supported. Use them.
window.addEventListener('load', function () {
// Wait for registration to finish before dropping the <script> tag.
// Otherwise, the browser will load the script multiple times,
// potentially different versions.
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
navigator.serviceWorker.register(serviceWorkerUrl)
.then((reg) => {
function waitForActivation(serviceWorker) {
serviceWorker.addEventListener('statechange', () => {
if (serviceWorker.state === 'activated') {
console.log('Installed new service worker.');
loadMainDartJs();
}
});
}
if (!reg.active && (reg.installing || reg.waiting)) {
// No active web worker and we have installed or are installing
// one for the first time. Simply wait for it to activate.
waitForActivation(reg.installing || reg.waiting);
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
// When the app updates the serviceWorkerVersion changes, so we
// need to ask the service worker to update.
console.log('New service worker available.');
reg.update();
waitForActivation(reg.installing);
} else {
// Existing service worker is still good.
console.log('Loading app from service worker.');
loadMainDartJs();
}
window.addEventListener('load', function(ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function(engineInitializer) {
engineInitializer.initializeEngine().then(function(appRunner) {
appRunner.runApp();
});

// If service worker doesn't succeed in a reasonable amount of time,
// fallback to plaint <script> tag.
setTimeout(() => {
if (!scriptLoaded) {
console.warn(
'Failed to load app from service worker. Falling back to plain <script> tag.',
);
loadMainDartJs();
}
}, 4000);
}
});
} else {
// Service workers not supported. Just drop the <script> tag.
loadMainDartJs();
}
});
</script>
</body>
</html>
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "OpenHaystack2.0",
"description": "Macless Haystack",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
Expand All @@ -32,4 +32,4 @@
"purpose": "maskable"
}
]
}
}

0 comments on commit 9b8e908

Please sign in to comment.