mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Admin Portal - Hosted
This commit is contained in:
parent
59fdc51ce0
commit
a551600c51
File diff suppressed because it is too large
Load Diff
Binary file not shown.
144
public/flutter.js
vendored
Normal file
144
public/flutter.js
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
if (!_flutter) {
|
||||
var _flutter = {};
|
||||
}
|
||||
_flutter.loader = null;
|
||||
|
||||
(function() {
|
||||
"use strict";
|
||||
class FlutterLoader {
|
||||
// TODO: Move the below methods to "#private" once supported by all the browsers
|
||||
// we support. In the meantime, we use the "revealing module" pattern.
|
||||
|
||||
// Watchdog to prevent injecting the main entrypoint multiple times.
|
||||
_scriptLoaded = null;
|
||||
|
||||
// Resolver for the pending promise returned by loadEntrypoint.
|
||||
_didCreateEngineInitializerResolve = null;
|
||||
|
||||
/**
|
||||
* Initializes the main.dart.js with/without serviceWorker.
|
||||
* @param {*} options
|
||||
* @returns a Promise that will eventually resolve with an EngineInitializer,
|
||||
* or will be rejected with the error caused by the loader.
|
||||
*/
|
||||
loadEntrypoint(options) {
|
||||
const {
|
||||
entrypointUrl = "main.dart.js",
|
||||
serviceWorker,
|
||||
} = (options || {});
|
||||
return this._loadWithServiceWorker(entrypointUrl, serviceWorker);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves the promise created by loadEntrypoint. Called by Flutter.
|
||||
* Needs to be weirdly bound like it is, so "this" is preserved across
|
||||
* the JS <-> Flutter jumps.
|
||||
* @param {*} engineInitializer
|
||||
*/
|
||||
didCreateEngineInitializer = (function(engineInitializer) {
|
||||
if (typeof this._didCreateEngineInitializerResolve != "function") {
|
||||
console.warn("Do not call didCreateEngineInitializer by hand. Start with loadEntrypoint instead.");
|
||||
}
|
||||
this._didCreateEngineInitializerResolve(engineInitializer);
|
||||
// Remove this method after it's done, so Flutter Web can hot restart.
|
||||
delete this.didCreateEngineInitializer;
|
||||
}).bind(this);
|
||||
|
||||
_loadEntrypoint(entrypointUrl) {
|
||||
if (!this._scriptLoaded) {
|
||||
this._scriptLoaded = new Promise((resolve, reject) => {
|
||||
let scriptTag = document.createElement("script");
|
||||
scriptTag.src = entrypointUrl;
|
||||
scriptTag.type = "application/javascript";
|
||||
this._didCreateEngineInitializerResolve = resolve; // Cache the resolve, so it can be called from Flutter.
|
||||
scriptTag.addEventListener("error", reject);
|
||||
document.body.append(scriptTag);
|
||||
});
|
||||
}
|
||||
|
||||
return this._scriptLoaded;
|
||||
}
|
||||
|
||||
_waitForServiceWorkerActivation(serviceWorker, entrypointUrl) {
|
||||
if (!serviceWorker || serviceWorker.state == "activated") {
|
||||
if (!serviceWorker) {
|
||||
console.warn("Cannot activate a null service worker. Falling back to plain <script> tag.");
|
||||
} else {
|
||||
console.debug("Service worker already active.");
|
||||
}
|
||||
return this._loadEntrypoint(entrypointUrl);
|
||||
}
|
||||
return new Promise((resolve, _) => {
|
||||
serviceWorker.addEventListener("statechange", () => {
|
||||
if (serviceWorker.state == "activated") {
|
||||
console.debug("Installed new service worker.");
|
||||
resolve(this._loadEntrypoint(entrypointUrl));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_loadWithServiceWorker(entrypointUrl, serviceWorkerOptions) {
|
||||
if (!("serviceWorker" in navigator) || serviceWorkerOptions == null) {
|
||||
console.warn("Service worker not supported (or configured). Falling back to plain <script> tag.", serviceWorkerOptions);
|
||||
return this._loadEntrypoint(entrypointUrl);
|
||||
}
|
||||
|
||||
const {
|
||||
serviceWorkerVersion,
|
||||
timeoutMillis = 4000,
|
||||
} = serviceWorkerOptions;
|
||||
|
||||
let serviceWorkerUrl = "flutter_service_worker.js?v=" + serviceWorkerVersion;
|
||||
let loader = navigator.serviceWorker.register(serviceWorkerUrl)
|
||||
.then((reg) => {
|
||||
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.
|
||||
let sw = reg.installing || reg.waiting;
|
||||
return this._waitForServiceWorkerActivation(sw, entrypointUrl);
|
||||
} 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.debug("New service worker available.");
|
||||
return reg.update().then((reg) => {
|
||||
console.debug("Service worker updated.");
|
||||
let sw = reg.installing || reg.waiting || reg.active;
|
||||
return this._waitForServiceWorkerActivation(sw, entrypointUrl);
|
||||
});
|
||||
} else {
|
||||
// Existing service worker is still good.
|
||||
console.debug("Loading app from service worker.");
|
||||
return this._loadEntrypoint(entrypointUrl);
|
||||
}
|
||||
});
|
||||
|
||||
// Timeout race promise
|
||||
let timeout;
|
||||
if (timeoutMillis > 0) {
|
||||
timeout = new Promise((resolve, _) => {
|
||||
setTimeout(() => {
|
||||
if (!this._scriptLoaded) {
|
||||
console.warn("Failed to load app from service worker. Falling back to plain <script> tag.");
|
||||
resolve(this._loadEntrypoint(entrypointUrl));
|
||||
}
|
||||
}, timeoutMillis);
|
||||
});
|
||||
}
|
||||
|
||||
return Promise.race([loader, timeout]);
|
||||
}
|
||||
}
|
||||
|
||||
_flutter.loader = new FlutterLoader();
|
||||
}());
|
12
public/flutter_service_worker.js
vendored
12
public/flutter_service_worker.js
vendored
@ -4,7 +4,7 @@ const TEMP = 'flutter-temp-cache';
|
||||
const CACHE_NAME = 'flutter-app-cache';
|
||||
const RESOURCES = {
|
||||
"favicon.png": "dca91c54388f52eded692718d5a98b8b",
|
||||
"main.dart.js": "405baf11805a6cc292fe5d6ad21109e2",
|
||||
"main.dart.js": "57a29d2c184bc16f405abf15c0b44f3f",
|
||||
"icons/Icon-192.png": "bb1cf5f6982006952211c7c8404ffbed",
|
||||
"icons/Icon-512.png": "0f9aff01367f0a0c69773d25ca16ef35",
|
||||
"favicon.ico": "51636d3a390451561744c42188ccd628",
|
||||
@ -14,9 +14,9 @@ const RESOURCES = {
|
||||
"canvaskit/canvaskit.wasm": "4b83d89d9fecbea8ca46f2f760c5a9ba",
|
||||
"version.json": "3afb81924daf4f751571755436069115",
|
||||
"assets/packages/material_design_icons_flutter/lib/fonts/materialdesignicons-webfont.ttf": "b62641afc9ab487008e996a5c5865e56",
|
||||
"assets/fonts/MaterialIcons-Regular.otf": "7e7a6cccddf6d7b20012a548461d5d81",
|
||||
"assets/fonts/MaterialIcons-Regular.otf": "95db9098c58fd6db106f1116bae85a0b",
|
||||
"assets/AssetManifest.json": "38d9aea341601f3a5c6fa7b5a1216ea5",
|
||||
"assets/NOTICES": "e39f4d8d7a45f123298d0dd94ac1ba80",
|
||||
"assets/NOTICES": "52d7174bb068ef86545951d5bc8c5744",
|
||||
"assets/FontManifest.json": "cf3c681641169319e61b61bd0277378f",
|
||||
"assets/assets/images/google_logo.png": "0f118259ce403274f407f5e982e681c3",
|
||||
"assets/assets/images/payment_types/solo.png": "2030c3ccaccf5d5e87916a62f5b084d6",
|
||||
@ -37,15 +37,15 @@ const RESOURCES = {
|
||||
"assets/assets/images/icon.png": "090f69e23311a4b6d851b3880ae52541",
|
||||
"assets/assets/images/logo_light.png": "e5f46d5a78e226e7a9553d4ca6f69219",
|
||||
"assets/assets/images/logo_dark.png": "a233ed1d4d0f7414bf97a9a10f11fb0a",
|
||||
"/": "11012b191ca75cbf64b79eb3bb3931ef",
|
||||
"flutter.js": "0816e65a103ba8ba51b174eeeeb2cb67",
|
||||
"/": "4da6241df001dc38bb3006c1b1fda776",
|
||||
"manifest.json": "ef43d90e57aa7682d7e2cfba2f484a40"
|
||||
};
|
||||
|
||||
// The application shell files that are downloaded before a service worker can
|
||||
// start.
|
||||
const CORE = [
|
||||
"/",
|
||||
"main.dart.js",
|
||||
"main.dart.js",
|
||||
"assets/NOTICES",
|
||||
"assets/AssetManifest.json",
|
||||
"assets/FontManifest.json"];
|
||||
|
385012
public/main.dart.js
vendored
385012
public/main.dart.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user