diff --git a/frontend/Exence/angular.json b/frontend/Exence/angular.json index b909a38f..ee1edbd3 100644 --- a/frontend/Exence/angular.json +++ b/frontend/Exence/angular.json @@ -22,7 +22,7 @@ "browser": "src/main.ts", "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", - "assets": ["src/assets"], + "assets": ["src/assets", { "glob": "manifest.webmanifest", "input": "src", "output": "/" }], "styles": ["src/styles/styles.scss"], "scripts": ["node_modules/apexcharts/dist/apexcharts.min.js"], "stylePreprocessorOptions": { @@ -33,6 +33,7 @@ }, "configurations": { "production": { + "serviceWorker": "ngsw-config.json", "budgets": [ { "type": "initial", diff --git a/frontend/Exence/ngsw-config.json b/frontend/Exence/ngsw-config.json new file mode 100644 index 00000000..b4f5aa44 --- /dev/null +++ b/frontend/Exence/ngsw-config.json @@ -0,0 +1,21 @@ +{ + "$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)"] + } + } + ] +} diff --git a/frontend/Exence/package-lock.json b/frontend/Exence/package-lock.json index 91b4d98d..5e7b2d3b 100644 --- a/frontend/Exence/package-lock.json +++ b/frontend/Exence/package-lock.json @@ -19,6 +19,7 @@ "@angular/platform-browser": "^21.0.1", "@angular/platform-browser-dynamic": "^21.0.1", "@angular/router": "^21.0.1", + "@angular/service-worker": "^21.1.3", "@ngrx/signals": "^21.0.1", "angular-gridster2": "^21.0.1", "apexcharts": "^5.6.0", @@ -881,6 +882,26 @@ "rxjs": "^6.5.3 || ^7.4.0" } }, + "node_modules/@angular/service-worker": { + "version": "21.1.3", + "resolved": "https://registry.npmjs.org/@angular/service-worker/-/service-worker-21.1.3.tgz", + "integrity": "sha512-5qJD2JsFLn9H1BMQvEUzfKZhX7oMkgYRTfuPbQuyuxfR9U8M5EYifRqOtAY6xyIUDjnn0FOS6dqMPOq49DGAog==", + "license": "MIT", + "peer": true, + "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": "21.1.3", + "rxjs": "^6.5.3 || ^7.4.0" + } + }, "node_modules/@babel/code-frame": { "version": "7.29.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", diff --git a/frontend/Exence/package.json b/frontend/Exence/package.json index b242d57c..023f5796 100644 --- a/frontend/Exence/package.json +++ b/frontend/Exence/package.json @@ -30,6 +30,7 @@ "@angular/platform-browser": "^21.0.1", "@angular/platform-browser-dynamic": "^21.0.1", "@angular/router": "^21.0.1", + "@angular/service-worker": "^21.1.3", "@ngrx/signals": "^21.0.1", "angular-gridster2": "^21.0.1", "apexcharts": "^5.6.0", diff --git a/frontend/Exence/src/app/app.config.ts b/frontend/Exence/src/app/app.config.ts index 04366297..39c0608f 100644 --- a/frontend/Exence/src/app/app.config.ts +++ b/frontend/Exence/src/app/app.config.ts @@ -1,5 +1,6 @@ import { provideHttpClient, withInterceptors } from '@angular/common/http'; import { ApplicationConfig, importProvidersFrom, provideZonelessChangeDetection, isDevMode } from '@angular/core'; +import { provideServiceWorker } from '@angular/service-worker'; import { provideRouter } from '@angular/router'; import { LayoutModule } from '@angular/cdk/layout'; @@ -42,6 +43,10 @@ export const appConfig: ApplicationConfig = { provideDateFnsAdapter(), CookieService, provideHttpClient(), + provideServiceWorker('ngsw-worker.js', { + enabled: !isDevMode(), + registrationStrategy: 'registerWhenStable:30000', + }), provideTransloco({ config: { availableLangs: ['hu', 'en', 'de', 'es', 'fr', 'it', 'pl', 'sk'], diff --git a/frontend/Exence/src/assets/icons/icon-192x192.png b/frontend/Exence/src/assets/icons/icon-192x192.png new file mode 100644 index 00000000..2388d235 Binary files /dev/null and b/frontend/Exence/src/assets/icons/icon-192x192.png differ diff --git a/frontend/Exence/src/assets/icons/icon-512x512.png b/frontend/Exence/src/assets/icons/icon-512x512.png new file mode 100644 index 00000000..12be6416 Binary files /dev/null and b/frontend/Exence/src/assets/icons/icon-512x512.png differ diff --git a/frontend/Exence/src/index.html b/frontend/Exence/src/index.html index 72d49fe3..16e5a5ba 100644 --- a/frontend/Exence/src/index.html +++ b/frontend/Exence/src/index.html @@ -3,13 +3,19 @@