Delegate cache control from Flutter to browser (#3289)
(cherry picked from commit 9c3954a73803a0f1921926f86b9761156430dc2f)
This commit is contained in:
+27
-9
@@ -104,15 +104,33 @@
|
||||
|
||||
loadLanguageResources().finally(initialTmailApp);
|
||||
|
||||
_flutter.loader.load({
|
||||
serviceWorkerSettings: {
|
||||
serviceWorkerVersion: {{flutter_service_worker_version}},
|
||||
},
|
||||
onEntrypointLoaded: async function(engineInitializer) {
|
||||
const appRunner = await engineInitializer.initializeEngine();
|
||||
await appRunner.runApp();
|
||||
}
|
||||
});
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator
|
||||
.serviceWorker
|
||||
.getRegistrations()
|
||||
.then(async function(registrations) {
|
||||
try {
|
||||
await Promise.all(registrations.map(function(registration) {
|
||||
return registration.unregister();
|
||||
}));
|
||||
} catch (error) {
|
||||
console.log('[Twake Mail] Error unregistering service worker: ', error);
|
||||
}
|
||||
_flutter.loader.load({
|
||||
onEntrypointLoaded: async function(engineInitializer) {
|
||||
const appRunner = await engineInitializer.initializeEngine();
|
||||
await appRunner.runApp();
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
_flutter.loader.load({
|
||||
onEntrypointLoaded: async function(engineInitializer) {
|
||||
const appRunner = await engineInitializer.initializeEngine();
|
||||
await appRunner.runApp();
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="https://unpkg.com/pica/dist/pica.min.js" ></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user