123 lines
3.6 KiB
HTML
123 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<base href="/pwa/">
|
|
|
|
<meta charset="UTF-8">
|
|
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
|
|
<meta name="description" content="Comunidad de Regantes de Civán">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
|
<!-- Forzar renderizador HTML -->
|
|
<meta name="flutter-web-renderer" content="html">
|
|
|
|
<!-- PWA y iOS meta tags -->
|
|
<meta name="theme-color" content="#000000">
|
|
<meta name="mobile-web-app-capable" content="yes">
|
|
<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="CR-Civán">
|
|
<link rel="apple-touch-icon" href="icons/iconoCuadrado.png">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/png" href="icons/iconoCuadrado.png"/>
|
|
|
|
<title>CR-Civán</title>
|
|
<link rel="manifest" href="manifest.json">
|
|
|
|
<!-- Prevenir flash de fondo blanco con CSS -->
|
|
<style>
|
|
body {
|
|
background-color: #000000;
|
|
margin: 0;
|
|
padding: 0;
|
|
height: 100vh;
|
|
width: 100vw;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.initial-loader {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
width: 100vw;
|
|
background-color: #000000;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 999;
|
|
transition: opacity 0.5s ease-out;
|
|
}
|
|
|
|
.initial-loader img {
|
|
width: 150px;
|
|
height: 150px;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
// Definir la variable que falta
|
|
var serviceWorkerVersion = null;
|
|
|
|
window.flutterWebRenderer = 'html';
|
|
|
|
// Configuración específica para PWA
|
|
if ('serviceWorker' in navigator) {
|
|
window.addEventListener('load', function() {
|
|
navigator.serviceWorker.register('flutter_service_worker.js')
|
|
.then(function(reg) {
|
|
console.log('Service worker registered successfully');
|
|
})
|
|
.catch(function(e) {
|
|
console.error('Error during service worker registration:', e);
|
|
});
|
|
});
|
|
}
|
|
|
|
// Verificar si la app está instalada
|
|
function isAppInstalled() {
|
|
// Verificar si se está ejecutando como PWA
|
|
return window.matchMedia('(display-mode: standalone)').matches ||
|
|
window.navigator.standalone ||
|
|
document.referrer.includes('android-app://');
|
|
}
|
|
</script>
|
|
|
|
<script src="flutter.js" defer></script>
|
|
</head>
|
|
<body>
|
|
<!-- Pantalla de carga inicial para evitar parpadeo -->
|
|
<div id="initial-loader" class="initial-loader">
|
|
<img src="icons/iconoCuadrado.png" alt="Cargando...">
|
|
</div>
|
|
|
|
<script>
|
|
window.addEventListener('load', function(ev) {
|
|
// Ocultar el loader cuando Flutter esté listo
|
|
var initialLoader = document.getElementById('initial-loader');
|
|
|
|
// Download main.dart.js
|
|
_flutter.loader.loadEntrypoint({
|
|
serviceWorker: {
|
|
serviceWorkerVersion: null,
|
|
},
|
|
onEntrypointLoaded: function(engineInitializer) {
|
|
engineInitializer.initializeEngine().then(function(appRunner) {
|
|
// Agregar un breve retraso antes de ocultar el loader
|
|
setTimeout(function() {
|
|
initialLoader.style.opacity = '0';
|
|
setTimeout(function() {
|
|
initialLoader.style.display = 'none';
|
|
}, 500);
|
|
}, 300);
|
|
appRunner.runApp();
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<script src="main.dart.js" type="application/javascript"></script>
|
|
</body>
|
|
</html>
|