diff --git a/angular.json b/angular.json index 92bb78f..8d3d028 100644 --- a/angular.json +++ b/angular.json @@ -47,7 +47,8 @@ "maximumError": "8kB" } ], - "outputHashing": "all" + "outputHashing": "all", + "serviceWorker": "ngsw-config.json" }, "development": { "optimization": false, diff --git a/ngsw-config.json b/ngsw-config.json new file mode 100644 index 0000000..69edd28 --- /dev/null +++ b/ngsw-config.json @@ -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.csr.html", + "/index.html", + "/manifest.webmanifest", + "/*.css", + "/*.js" + ] + } + }, + { + "name": "assets", + "installMode": "lazy", + "updateMode": "prefetch", + "resources": { + "files": [ + "/**/*.(svg|cur|jpg|jpeg|png|apng|webp|avif|gif|otf|ttf|woff|woff2)" + ] + } + } + ] +} diff --git a/package-lock.json b/package-lock.json index f218102..be2ffd6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@angular/forms": "^20.3.15", "@angular/platform-browser": "^20.3.15", "@angular/router": "^20.3.15", + "@angular/service-worker": "^20.3.15", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" @@ -596,6 +597,25 @@ "rxjs": "^6.5.3 || ^7.4.0" } }, + "node_modules/@angular/service-worker": { + "version": "20.3.15", + "resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-20.3.15.tgz", + "integrity": "sha512-HCptODPVWg30XJwSueOz2zqsJjQ1chSscTs7FyIQcfuCTTthO35Lvz2Gtct8/GNHel9QNvvVwA5jrLjsU4dt1A==", + "license": "MIT", + "dependencies": { + "tslib": "^2.3.0" + }, + "bin": { + "ngsw-config": "ngsw-config.js" + }, + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@angular/core": "20.3.15", + "rxjs": "^6.5.3 || ^7.4.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.27.1", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", diff --git a/package.json b/package.json index fabf5ee..b2576c6 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "@angular/forms": "^20.3.15", "@angular/platform-browser": "^20.3.15", "@angular/router": "^20.3.15", + "@angular/service-worker": "^20.3.15", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.15.0" diff --git a/public/icons/icon-128x128.png b/public/icons/icon-128x128.png new file mode 100644 index 0000000..1592530 Binary files /dev/null and b/public/icons/icon-128x128.png differ diff --git a/public/icons/icon-144x144.png b/public/icons/icon-144x144.png new file mode 100644 index 0000000..58ebeea Binary files /dev/null and b/public/icons/icon-144x144.png differ diff --git a/public/icons/icon-152x152.png b/public/icons/icon-152x152.png new file mode 100644 index 0000000..e7e5603 Binary files /dev/null and b/public/icons/icon-152x152.png differ diff --git a/public/icons/icon-192x192.png b/public/icons/icon-192x192.png new file mode 100644 index 0000000..7cc5b96 Binary files /dev/null and b/public/icons/icon-192x192.png differ diff --git a/public/icons/icon-384x384.png b/public/icons/icon-384x384.png new file mode 100644 index 0000000..c5cba87 Binary files /dev/null and b/public/icons/icon-384x384.png differ diff --git a/public/icons/icon-512x512.png b/public/icons/icon-512x512.png new file mode 100644 index 0000000..ca00a0b Binary files /dev/null and b/public/icons/icon-512x512.png differ diff --git a/public/icons/icon-72x72.png b/public/icons/icon-72x72.png new file mode 100644 index 0000000..651b3a5 Binary files /dev/null and b/public/icons/icon-72x72.png differ diff --git a/public/icons/icon-96x96.png b/public/icons/icon-96x96.png new file mode 100644 index 0000000..3b15a0f Binary files /dev/null and b/public/icons/icon-96x96.png differ diff --git a/public/manifest.webmanifest b/public/manifest.webmanifest new file mode 100644 index 0000000..b038b6e --- /dev/null +++ b/public/manifest.webmanifest @@ -0,0 +1,58 @@ +{ + "name": "Gabigenda", + "short_name": "Gabigenda", + "display": "standalone", + "scope": "./", + "background_color": "#ff0000", + "start_url": "./", + "icons": [ + { + "src": "icons/icon-72x72.png", + "sizes": "72x72", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-128x128.png", + "sizes": "128x128", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-144x144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-152x152.png", + "sizes": "152x152", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-192x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-384x384.png", + "sizes": "384x384", + "type": "image/png", + "purpose": "maskable any" + }, + { + "src": "icons/icon-512x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable any" + } + ] +} diff --git a/src/app/app.config.ts b/src/app/app.config.ts index 2ae0d5d..755036f 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -2,7 +2,7 @@ import { ApplicationConfig, InjectionToken, provideBrowserGlobalErrorListeners, - provideZoneChangeDetection, + provideZoneChangeDetection, isDevMode, } from '@angular/core'; import { provideRouter } from '@angular/router'; @@ -10,6 +10,7 @@ import { routes } from './app.routes'; import { strings } from './strings'; import { provideHttpClient } from '@angular/common/http'; import { Language } from './types/Language.type'; +import { provideServiceWorker } from '@angular/service-worker'; const STRINGS_TOKEN = 'strings'; export const STRINGS_INJECTOR = new InjectionToken(STRINGS_TOKEN); @@ -24,6 +25,9 @@ export const appConfig: ApplicationConfig = { provideRouter(routes), provideHttpClient(), { provide: STRINGS_INJECTOR, useValue: strings }, - { provide: LS_LANGUAGE, useValue: 'language' }, + { provide: LS_LANGUAGE, useValue: 'language' }, provideServiceWorker('ngsw-worker.js', { + enabled: !isDevMode(), + registrationStrategy: 'registerWhenStable:30000' + }), ], }; diff --git a/src/index.html b/src/index.html index f55265f..0f86c9d 100644 --- a/src/index.html +++ b/src/index.html @@ -6,10 +6,12 @@ - + + +