Created PWA

This commit is contained in:
Zakary Timson 2018-11-14 14:19:11 -05:00
parent d69949538c
commit 7fbb7272bf
18 changed files with 4131 additions and 334 deletions

View File

@ -23,7 +23,8 @@
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json", "tsConfig": "src/tsconfig.app.json",
"assets": [ "assets": [
"src/assets" "src/assets",
"src/manifest.json"
], ],
"styles": [ "styles": [
"src/styles.scss" "src/styles.scss"
@ -53,7 +54,8 @@
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "5mb"
} }
] ],
"serviceWorker": true
} }
} }
}, },
@ -86,7 +88,8 @@
], ],
"scripts": [], "scripts": [],
"assets": [ "assets": [
"src/assets" "src/assets",
"src/manifest.json"
] ]
} }
}, },

25
ngsw-config.json Normal file
View File

@ -0,0 +1,25 @@
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**"
]
}
}
]
}

4334
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,9 @@
"@angular/material": "^7.0.4", "@angular/material": "^7.0.4",
"@angular/platform-browser": "~7.0.0", "@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0", "@angular/platform-browser-dynamic": "~7.0.0",
"@angular/pwa": "^0.10.5",
"@angular/router": "~7.0.0", "@angular/router": "~7.0.0",
"@angular/service-worker": "~7.0.0",
"core-js": "^2.5.4", "core-js": "^2.5.4",
"firebase": "^5.5.8", "firebase": "^5.5.8",
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",

View File

@ -23,7 +23,7 @@ import {HttpClientModule} from '@angular/common/http';
import { LoginComponent } from './login/login.component'; import { LoginComponent } from './login/login.component';
import {environment} from '../environments/environment'; import {environment} from '../environments/environment';
import * as firebase from 'firebase/app'; import * as firebase from 'firebase/app';
import {LoginGuard} from './login/login.guard'; import { ServiceWorkerModule } from '@angular/service-worker';
export const firebaseApp = firebase.initializeApp(environment.firebase); export const firebaseApp = firebase.initializeApp(environment.firebase);
@ -52,8 +52,9 @@ export const firebaseApp = firebase.initializeApp(environment.firebase);
MatListModule, MatListModule,
MatSidenavModule, MatSidenavModule,
MatToolbarModule, MatToolbarModule,
ServiceWorkerModule.register('ngsw-worker.js', { enabled: false }),
], ],
providers: [LoginGuard], providers: [],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { export class AppModule {

View File

@ -2,7 +2,9 @@ import {CanActivate, Router} from '@angular/router';
import {firebaseApp} from '../app.module'; import {firebaseApp} from '../app.module';
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
@Injectable() @Injectable({
providedIn: 'root'
})
export class LoginGuard implements CanActivate { export class LoginGuard implements CanActivate {
constructor(private router: Router) {} constructor(private router: Router) {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

View File

@ -8,8 +8,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="assets/icon.png"> <link rel="icon" type="image/x-icon" href="assets/icon.png">
<link rel="stylesheet" type="text/css" href="assets/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="assets/bootstrap.min.css">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#1976d2">
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body> </body>
</html> </html>

View File

@ -1,9 +1,7 @@
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module'; import { AppModule } from './app/app.module';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
import 'hammerjs'; import 'hammerjs';
if (environment.production) { if (environment.production) {

51
src/manifest.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "Home Front",
"short_name": "Home Front",
"theme_color": "#f8f8f8",
"background_color": "#2f323a",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}

View File

@ -211,6 +211,17 @@
dependencies: dependencies:
tslib "^1.9.0" tslib "^1.9.0"
"@angular/pwa@^0.10.5":
version "0.10.5"
resolved "https://registry.yarnpkg.com/@angular/pwa/-/pwa-0.10.5.tgz#31a64d5165e16a53d86ff9347d0dd9ce0df48bfc"
integrity sha512-GFEtSkW7CDEX7G7cybVRDRWj0ZBOImFJ+uyx5/hqnaYM68nrgOMr4tKOqciyU5KYm8cexvjrCB5lrB2z0DFcbg==
dependencies:
"@angular-devkit/core" "7.0.5"
"@angular-devkit/schematics" "7.0.5"
"@schematics/angular" "7.0.5"
parse5-html-rewriting-stream "5.1.0"
rxjs "6.3.3"
"@angular/router@~7.0.0": "@angular/router@~7.0.0":
version "7.0.3" version "7.0.3"
resolved "https://registry.yarnpkg.com/@angular/router/-/router-7.0.3.tgz#7cf86ad1667a892998ec3670ab7ba0b2b373c24a" resolved "https://registry.yarnpkg.com/@angular/router/-/router-7.0.3.tgz#7cf86ad1667a892998ec3670ab7ba0b2b373c24a"
@ -6621,12 +6632,27 @@ parse-json@^4.0.0:
error-ex "^1.3.1" error-ex "^1.3.1"
json-parse-better-errors "^1.0.1" json-parse-better-errors "^1.0.1"
parse5-html-rewriting-stream@5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/parse5-html-rewriting-stream/-/parse5-html-rewriting-stream-5.1.0.tgz#63f92c958764aea8cbe3aa68f2e5895c32068ab8"
integrity sha512-hZlaOTHJs4dpC5yFHnOSEMh26ErsqTsLzxKqkuRcUqtiu0kMsBQ9pkgANkECDyoBUhJ3+hvb2DPLsyqbtcS61Q==
dependencies:
parse5 "^5.1.0"
parse5-sax-parser "^5.1.0"
parse5-sax-parser@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/parse5-sax-parser/-/parse5-sax-parser-5.1.0.tgz#ec234d23223a8054a74ff173aa3dc2da74c5bbd9"
integrity sha512-VEhdEDhBkoSILPmsZ96SoIIUow3hZbtgQsqXw7r8DxxnqsCIO0fwkT9mWgBcf9SPjVUh92liuEprHrrYzXBPWQ==
dependencies:
parse5 "^5.1.0"
parse5@4.0.0: parse5@4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608"
integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==
parse5@^5.0.0: parse5@^5.0.0, parse5@^5.1.0:
version "5.1.0" version "5.1.0"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2"
integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ== integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==