added service workers

This commit is contained in:
Nicolas Constant 2020-02-25 22:52:50 -05:00
parent 73f0628519
commit 24821d9e94
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
15 changed files with 386 additions and 399 deletions

View File

@ -18,7 +18,8 @@
"polyfills": "src/polyfills.ts", "polyfills": "src/polyfills.ts",
"assets": [ "assets": [
"src/assets", "src/assets",
"src/favicon.ico" "src/favicon.ico",
"src/manifest.json"
], ],
"styles": [ "styles": [
"src/sass/styles.scss", "src/sass/styles.scss",
@ -48,7 +49,9 @@
"replace": "src/environments/environment.ts", "replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts" "with": "src/environments/environment.prod.ts"
} }
] ],
"serviceWorker": true,
"ngswConfigPath": "src/ngsw-config.json"
} }
} }
}, },
@ -82,7 +85,8 @@
], ],
"assets": [ "assets": [
"src/assets", "src/assets",
"src/favicon.ico" "src/favicon.ico",
"src/manifest.json"
], ],
"stylePreprocessorOptions": { "stylePreprocessorOptions": {
"includePaths": [ "includePaths": [

425
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,9 @@
"@angular/http": "^7.2.7", "@angular/http": "^7.2.7",
"@angular/platform-browser": "^7.2.7", "@angular/platform-browser": "^7.2.7",
"@angular/platform-browser-dynamic": "^7.2.7", "@angular/platform-browser-dynamic": "^7.2.7",
"@angular/pwa": "^0.12.4",
"@angular/router": "^7.2.7", "@angular/router": "^7.2.7",
"@angular/service-worker": "^7.2.7",
"@ctrl/ngx-emoji-mart": "^0.17.0", "@ctrl/ngx-emoji-mart": "^0.17.0",
"@fortawesome/angular-fontawesome": "^0.3.0", "@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.13", "@fortawesome/fontawesome-svg-core": "^1.2.13",

View File

@ -79,6 +79,8 @@ import { ScheduledStatusesComponent } from './components/floating-column/schedul
import { ScheduledStatusComponent } from './components/floating-column/scheduled-statuses/scheduled-status/scheduled-status.component'; import { ScheduledStatusComponent } from './components/floating-column/scheduled-statuses/scheduled-status/scheduled-status.component';
import { StreamNotificationsComponent } from './components/stream/stream-notifications/stream-notifications.component'; import { StreamNotificationsComponent } from './components/stream/stream-notifications/stream-notifications.component';
import { NotificationComponent } from './components/floating-column/manage-account/notifications/notification/notification.component'; import { NotificationComponent } from './components/floating-column/manage-account/notifications/notification/notification.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
const routes: Routes = [ const routes: Routes = [
@ -167,7 +169,8 @@ const routes: Routes = [
]), ]),
NgxsStoragePluginModule.forRoot(), NgxsStoragePluginModule.forRoot(),
ContextMenuModule.forRoot(), ContextMenuModule.forRoot(),
HotkeyModule.forRoot() HotkeyModule.forRoot(),
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
], ],
providers: [AuthService, NavigationService, NotificationService, MastodonWrapperService, MastodonService, StreamingService], providers: [AuthService, NavigationService, NotificationService, MastodonWrapperService, MastodonService, StreamingService],
bootstrap: [AppComponent], bootstrap: [AppComponent],

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

View File

@ -50,6 +50,8 @@
} }
} }
</style> </style>
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#1976d2">
</head> </head>
<body ondragstart="return false;" ondrop="return false;"> <body ondragstart="return false;" ondrop="return false;">
@ -59,5 +61,6 @@
<div></div> <div></div>
</div> </div>
</app-root> </app-root>
<noscript>Please enable JavaScript to continue using this application.</noscript>
</body> </body>
</html> </html>

51
src/manifest.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "sengi",
"short_name": "sengi",
"theme_color": "#1976d2",
"background_color": "#fafafa",
"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"
}
]
}

27
src/ngsw-config.json Normal file
View File

@ -0,0 +1,27 @@
{
"index": "/index.html",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
"/index.html",
"/*.css",
"/*.js"
]
}
}, {
"name": "assets",
"installMode": "lazy",
"updateMode": "prefetch",
"resources": {
"files": [
"/assets/**",
"/*.(eot|svg|cur|jpg|png|webp|gif|otf|ttf|woff|woff2|ani)"
]
}
}
]
}