diff --git a/src/js/App.tsx b/src/js/App.tsx index 89d7dd3..ed7023b 100644 --- a/src/js/App.tsx +++ b/src/js/App.tsx @@ -1,25 +1,33 @@ -import * as React from 'react'; -import * as ReactDOM from 'react-dom'; -import { Provider } from 'react-redux'; +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { Provider } from "react-redux"; -import { Route, Redirect } from 'react-router'; -import { HashRouter } from 'react-router-dom'; -import { ConnectedRouter } from 'connected-react-router'; +import { Route, Redirect } from "react-router"; +import { HashRouter } from "react-router-dom"; +import { ConnectedRouter } from "connected-react-router"; // Layouts -import DefaultLayout from './layout/DefaultLayout'; +import DefaultLayout from "./layout/DefaultLayout"; -import store, { history } from './store'; -import LoadableStoreApp from './apps/Store'; +import store, { history } from "./store"; +import LoadableStoreApp from "./apps/Store"; export default class App { domId: string; - constructor(id: string = 'app') { + constructor(id: string = "app") { this.domId = id; } run() { + // Check that service workers are supported + if ('serviceWorker' in navigator) { + // Use the window load event to keep the page load performant + window.addEventListener('load', () => { + navigator.serviceWorker.register('./serviceWorker.js'); + }); + } + ReactDOM.render( @@ -32,8 +40,7 @@ export default class App { , - document.getElementById(this.domId), + document.getElementById(this.domId) ); } } - diff --git a/www/manifest.webmanifest b/www/manifest.webmanifest index 6e13d4d..86cee6f 100644 --- a/www/manifest.webmanifest +++ b/www/manifest.webmanifest @@ -1,3 +1,52 @@ { - "short_name": "PlayOS" -} + "name": "PlayOS", + "short_name": "PlayOS", + "theme_color": "#ff22ff", + "background_color": "#2196f3", + "display": "standalone", + "scope": "/", + "start_url": "/", + "icons": [ + { + "src": "res/img/icons/icon-72x72.png", + "sizes": "72x72", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-96x96.png", + "sizes": "96x96", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-144x144.png", + "sizes": "144x144", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-384x384.png", + "sizes": "384x384", + "type": "image/png" + }, + { + "src": "res/img/icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "splash_pages": null + } diff --git a/www/res/img/icons/icon-128x128.png b/www/res/img/icons/icon-128x128.png new file mode 100644 index 0000000..4aacf28 Binary files /dev/null and b/www/res/img/icons/icon-128x128.png differ diff --git a/www/res/img/icons/icon-144x144.png b/www/res/img/icons/icon-144x144.png new file mode 100644 index 0000000..2aee159 Binary files /dev/null and b/www/res/img/icons/icon-144x144.png differ diff --git a/www/res/img/icons/icon-152x152.png b/www/res/img/icons/icon-152x152.png new file mode 100644 index 0000000..8cdc951 Binary files /dev/null and b/www/res/img/icons/icon-152x152.png differ diff --git a/www/res/img/icons/icon-192x192.png b/www/res/img/icons/icon-192x192.png new file mode 100644 index 0000000..d42eba4 Binary files /dev/null and b/www/res/img/icons/icon-192x192.png differ diff --git a/www/res/img/icons/icon-384x384.png b/www/res/img/icons/icon-384x384.png new file mode 100644 index 0000000..fa1c253 Binary files /dev/null and b/www/res/img/icons/icon-384x384.png differ diff --git a/www/res/img/icons/icon-512x512.png b/www/res/img/icons/icon-512x512.png new file mode 100644 index 0000000..c3e7199 Binary files /dev/null and b/www/res/img/icons/icon-512x512.png differ diff --git a/www/res/img/icons/icon-72x72.png b/www/res/img/icons/icon-72x72.png new file mode 100644 index 0000000..1d19bc0 Binary files /dev/null and b/www/res/img/icons/icon-72x72.png differ diff --git a/www/res/img/icons/icon-96x96.png b/www/res/img/icons/icon-96x96.png new file mode 100644 index 0000000..c76194c Binary files /dev/null and b/www/res/img/icons/icon-96x96.png differ diff --git a/www/serviceWorker.js b/www/serviceWorker.js new file mode 100644 index 0000000..86162fe --- /dev/null +++ b/www/serviceWorker.js @@ -0,0 +1,6 @@ +importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js'); + +workbox.routing.registerRoute( + /\.js$/, + new workbox.strategies.NetworkFirst(), +);