index.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <!--
  5. If you are serving your web app in a path other than the root, change the
  6. href value below to reflect the base path you are serving from.
  7. The path provided below has to start and end with a slash "/" in order for
  8. it to work correctly.
  9. For more details:
  10. * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
  11. This is a placeholder for base href that will be replaced by the value of
  12. the `--base-href` argument provided to `flutter build`.
  13. -->
  14. <base href="$FLUTTER_BASE_HREF">
  15. <meta charset="UTF-8">
  16. <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  17. <meta name="description" content="Datacom Solusindo">
  18. <!-- iOS meta tags & icons -->
  19. <meta name="mobile-web-app-capable" content="yes">
  20. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  21. <meta name="apple-mobile-web-app-title" content="TelNow Application">
  22. <link rel="apple-touch-icon" href="icons/Icon-192.png">
  23. <!-- Favicon -->
  24. <link rel="icon" type="image/png" href="favicon.ico"/>
  25. <title>TelNow Application</title>
  26. <link rel="manifest" href="manifest.json">
  27. <style>
  28. .loader {
  29. border: 5px solid #f3f3f3;
  30. border-radius: 50%;
  31. border-top: 5px solid #01beb5;
  32. width: 40px;
  33. height: 40px;
  34. -webkit-animation: spin 2s linear infinite; /* Safari */
  35. animation: spin 2s linear infinite;
  36. }
  37. .center {
  38. position: absolute;
  39. top: 50%;
  40. left: 50%;
  41. margin-top: -60px;
  42. margin-left: -120px;
  43. width: 240px;
  44. height: 40px;
  45. text-align: center;
  46. font-family: Arial, Helvetica, sans-serif;
  47. }
  48. .center-align {
  49. position: absolute;
  50. top: 50%;
  51. left: 50%;
  52. margin-top: 20px;
  53. margin-left: -60px;
  54. width: 40px;
  55. height: 40px;
  56. }
  57. .center-count {
  58. position: absolute;
  59. top: 50%;
  60. left: 50%;
  61. margin-top: -30px;
  62. margin-left: -120px;
  63. width: 240px;
  64. height: 40px;
  65. font-size: 20px;
  66. font-weight: bold;
  67. text-align: center;
  68. font-family: Arial, Helvetica, sans-serif;
  69. }
  70. /* Safari */
  71. @-webkit-keyframes spin {
  72. 0% { -webkit-transform: rotate(0deg); }
  73. 100% { -webkit-transform: rotate(360deg); }
  74. }
  75. @keyframes spin {
  76. 0% { transform: rotate(0deg); }
  77. 100% { transform: rotate(360deg); }
  78. }
  79. .countdown {
  80. display: inline-block;
  81. text-indent: -100vw;
  82. position:relative;
  83. width: 1ch;
  84. }
  85. .countdown::after {
  86. content: '10';
  87. position:absolute;
  88. top:0;
  89. left:0;
  90. text-indent: 0;
  91. animation: 18s countdown 1s forwards;
  92. }
  93. @keyframes countdown {
  94. 0% { content: '10'; }
  95. 10% { content: '9'; }
  96. 20% { content: '8'; }
  97. 30% { content: '7'; }
  98. 35% { content: '7'; }
  99. 40% { content: '6'; }
  100. 45% { content: '6'; }
  101. 50% { content: '5'; }
  102. 55% { content: '5'; }
  103. 60% { content: '4'; }
  104. 65% { content: '4'; }
  105. 70% { content: '3'; }
  106. 75% { content: '2'; }
  107. 80% { content: '2'; }
  108. 85% { content: '2'; }
  109. 90% { content: '1'; }
  110. 95% { content: '1'; }
  111. 100% { content: '0'; }
  112. }
  113. </style>
  114. </head>
  115. <body>
  116. <script src="flutter_bootstrap.js" async></script>
  117. <div class="center">
  118. <h4 id="label">Loading TelNow page</h4>
  119. </div>
  120. <div class="center-align">
  121. <img src="cat.gif" width="120" height="120">
  122. </div>
  123. <div class="center-count">
  124. <span class="countdown"></span>
  125. </div>
  126. <!-- This script installs service_worker.js to provide PWA functionality to
  127. application. For more information, see:
  128. https://developers.google.com/web/fundamentals/primers/service-workers -->
  129. <script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
  130. <script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-auth.js"></script>
  131. <script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-messaging.js"></script>
  132. <script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-firestore.js"></script>
  133. <script>
  134. var serviceWorkerVersion = null;
  135. var scriptLoaded = false;
  136. function loadMainDartJs() {
  137. if (scriptLoaded) {
  138. return;
  139. }
  140. scriptLoaded = true;
  141. var scriptTag = document.createElement('script');
  142. scriptTag.src = 'main.dart.js';
  143. scriptTag.type = 'application/javascript';
  144. document.body.append(scriptTag);
  145. }
  146. if ('serviceWorker' in navigator) {
  147. // Service workers are supported. Use them.
  148. window.addEventListener('load', function () {
  149. // Wait for registration to finish before dropping the <script> tag.
  150. // Otherwise, the browser will load the script multiple times,
  151. // potentially different versions.
  152. var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
  153. navigator.serviceWorker.register(serviceWorkerUrl)
  154. .then((reg) => {
  155. function waitForActivation(serviceWorker) {
  156. serviceWorker.addEventListener('statechange', () => {
  157. if (serviceWorker.state == 'activated') {
  158. console.log('Installed new service worker.');
  159. loadMainDartJs();
  160. }
  161. });
  162. }
  163. if (!reg.active && (reg.installing || reg.waiting)) {
  164. // No active web worker and we have installed or are installing
  165. // one for the first time. Simply wait for it to activate.
  166. waitForActivation(reg.installing || reg.waiting);
  167. } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
  168. // When the app updates the serviceWorkerVersion changes, so we
  169. // need to ask the service worker to update.
  170. console.log('New service worker available.');
  171. reg.update();
  172. waitForActivation(reg.installing);
  173. } else {
  174. // Existing service worker is still good.
  175. console.log('Loading app from service worker.');
  176. loadMainDartJs();
  177. }
  178. });
  179. navigator.serviceWorker.register("firebase-messaging-sw.js").then((reg) => {
  180. if (!reg.active && (reg.installing || reg.waiting)) {
  181. // No active web worker and we have installed or are installing
  182. // one for the first time. Simply wait for it to activate.
  183. console.log('Firebase messaging has been installing.');
  184. } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
  185. // When the app updates the serviceWorkerVersion changes, so we
  186. // need to ask the service worker to update.
  187. console.log('Firebase messaging is available.');
  188. } else {
  189. // Existing service worker is still good.
  190. console.log('Firebase messaging has been running.');
  191. }
  192. });
  193. // If service worker doesn't succeed in a reasonable amount of time,
  194. // fallback to plaint <script> tag.
  195. setTimeout(() => {
  196. if (!scriptLoaded) {
  197. console.warn(
  198. 'Failed to load app from service worker. Falling back to plain <script> tag.',
  199. );
  200. loadMainDartJs();
  201. }
  202. }, 4000);
  203. });
  204. } else {
  205. // Service workers not supported. Just drop the <script> tag.
  206. loadMainDartJs();
  207. }
  208. </script>
  209. </body>
  210. </html>