add pwa support

This commit is contained in:
2022-12-06 14:59:34 +01:00
parent 2b40b2d0ab
commit 41e6e58128
16 changed files with 142 additions and 9 deletions

View File

@@ -25,14 +25,19 @@
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"src/styles.scss"
],
"scripts": [],
"allowedCommonJsDependencies": [ "moment" ]
"allowedCommonJsDependencies": [
"moment"
],
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
},
"configurations": {
"production": {
@@ -95,7 +100,8 @@
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
"src/manifest.webmanifest"
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",

30
Frontend/ngsw-config.json Normal file
View File

@@ -0,0 +1,30 @@
{
"$schema": "./node_modules/@angular/service-worker/config/schema.json",
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/manifest.webmanifest",
"/*.css",
"/*.js"
]
}
},
{
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)"
]
}
}
]
}

View File

@@ -1,12 +1,12 @@
{
"name": "diuna",
"version": "0.0.0",
"version": "0.0.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "diuna",
"version": "0.0.0",
"version": "0.0.1",
"dependencies": {
"@abacritt/angularx-social-login": "^1.2.5",
"@angular/animations": "^15.0.2",
@@ -20,6 +20,7 @@
"@angular/platform-browser-dynamic": "^15.0.2",
"@angular/pwa": "^15.0.2",
"@angular/router": "^15.0.2",
"@angular/service-worker": "^15.0.2",
"jwt-decode": "^3.1.2",
"moment": "^2.29.4",
"rxjs": "^7.6.0",
@@ -732,6 +733,24 @@
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/service-worker": {
"version": "15.0.2",
"resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-15.0.2.tgz",
"integrity": "sha512-r+9qS3ZoLkNutukzJLchZtr/NG16DGTcLu/Q2K84gTi/ybf88OCphL3uKwefF8BFguXoMNL+LLHEulrE1UzWaA==",
"dependencies": {
"tslib": "^2.3.0"
},
"bin": {
"ngsw-config": "ngsw-config.js"
},
"engines": {
"node": "^14.20.0 || ^16.13.0 || >=18.10.0"
},
"peerDependencies": {
"@angular/common": "15.0.2",
"@angular/core": "15.0.2"
}
},
"node_modules/@assemblyscript/loader": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz",
@@ -12338,6 +12357,14 @@
"tslib": "^2.3.0"
}
},
"@angular/service-worker": {
"version": "15.0.2",
"resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-15.0.2.tgz",
"integrity": "sha512-r+9qS3ZoLkNutukzJLchZtr/NG16DGTcLu/Q2K84gTi/ybf88OCphL3uKwefF8BFguXoMNL+LLHEulrE1UzWaA==",
"requires": {
"tslib": "^2.3.0"
}
},
"@assemblyscript/loader": {
"version": "0.10.1",
"resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz",

View File

@@ -22,6 +22,7 @@
"@angular/platform-browser-dynamic": "^15.0.2",
"@angular/pwa": "^15.0.2",
"@angular/router": "^15.0.2",
"@angular/service-worker": "^15.0.2",
"jwt-decode": "^3.1.2",
"moment": "^2.29.4",
"rxjs": "^7.6.0",

View File

@@ -1,4 +1,4 @@
import { NgModule } from '@angular/core';
import { NgModule, isDevMode } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
@@ -8,6 +8,7 @@ import { MainViewComponent } from './main-view/main-view.component';
import { MaterialModule } from './material.module';
import { LoginPageComponent } from './components/login-page/login-page.component';
import { HttpClientModule } from '@angular/common/http';
import { ServiceWorkerModule } from '@angular/service-worker';
@NgModule({
@@ -21,7 +22,13 @@ import { HttpClientModule } from '@angular/common/http';
AppRoutingModule,
BrowserAnimationsModule,
MaterialModule,
HttpClientModule
HttpClientModule,
ServiceWorkerModule.register('ngsw-worker.js', {
enabled: !isDevMode(),
// Register the ServiceWorker as soon as the application is stable
// or after 30 seconds (whichever comes first).
registrationStrategy: 'registerWhenStable:30000'
})
],
providers: [],
bootstrap: [AppComponent]

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -7,11 +7,14 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&amp;display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://accounts.google.com/gsi/client" async defer></script>
<script src="https://accounts.google.com/gsi/client" async="" defer=""></script>
<link rel="manifest" href="manifest.webmanifest">
<meta name="theme-color" content="#1976d2">
</head>
<body class="mat-typography">
<app-root></app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body>
</html>

View File

@@ -0,0 +1,59 @@
{
"name": "Diuna",
"short_name": "Diuna",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"display": "standalone",
"scope": "./",
"start_url": "./",
"icons": [
{
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-128x128.png",
"sizes": "128x128",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-144x144.png",
"sizes": "144x144",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-152x152.png",
"sizes": "152x152",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-384x384.png",
"sizes": "384x384",
"type": "image/png",
"purpose": "maskable any"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable any"
}
]
}