From 9ec4bcc34c7063d89f8eb7060f144266bae82ddf Mon Sep 17 00:00:00 2001 From: Sumedha Koranga Date: Sun, 4 Feb 2024 16:29:32 +0530 Subject: [PATCH] makes website PWA --- angular.json | 2 ++ src/app/app.module.ts | 9 +++++- src/index.html | 3 ++ src/manifest.webmanifest | 59 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 src/manifest.webmanifest diff --git a/angular.json b/angular.json index eb36818..2e257a3 100644 --- a/angular.json +++ b/angular.json @@ -33,6 +33,7 @@ "assets": [ "src/favicon.ico", "src/assets", + "src/manifest.webmanifest", "src/manifest.webmanifest" ], "styles": [ @@ -97,6 +98,7 @@ "assets": [ "src/favicon.ico", "src/assets", + "src/manifest.webmanifest", "src/manifest.webmanifest" ], "styles": [ diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 550d24a..4f06a03 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { NgModule, isDevMode } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { ReactiveFormsModule, FormsModule} from '@angular/forms'; import { AppRoutingModule } from './app-routing.module'; @@ -14,6 +14,7 @@ import { LoginComponent } from './login/login.component'; import { SignupComponent } from './signup/signup.component'; import { CoursesComponent } from './student/courses/courses.component'; import { ProgressComponent } from './student/progress/progress.component'; +import { ServiceWorkerModule } from '@angular/service-worker'; @NgModule({ declarations: [ @@ -35,6 +36,12 @@ import { ProgressComponent } from './student/progress/progress.component'; AppRoutingModule, FormsModule, ReactiveFormsModule, + 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] diff --git a/src/index.html b/src/index.html index e1136ca..e13302a 100644 --- a/src/index.html +++ b/src/index.html @@ -6,8 +6,11 @@ + + + diff --git a/src/manifest.webmanifest b/src/manifest.webmanifest new file mode 100644 index 0000000..d794e46 --- /dev/null +++ b/src/manifest.webmanifest @@ -0,0 +1,59 @@ +{ + "name": "Tutor.AI", + "short_name": "Tutor.AI", + "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" + } + ] +}