Skip to content
Snippets Groups Projects
Commit 95d07b15 authored by Lukas Mauß's avatar Lukas Mauß
Browse files

Add update notification

parent b137d0f3
Branches
Tags
1 merge request!188Add update notification
Pipeline #26508 failed with stages
in 2 minutes and 17 seconds
......@@ -17,6 +17,7 @@
{
"name": "app",
"installMode": "prefetch",
"updateMode": "prefetch",
"resources": {
"files": [
"/favicon.ico",
......
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { ThemeService } from '../theme/theme.service';
import { SwUpdate } from '@angular/service-worker';
import { NotificationService } from './services/util/notification.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
export class AppComponent implements OnInit {
constructor(private translationService: TranslateService,
private themeService: ThemeService) {
private update: SwUpdate,
public notification: NotificationService) {
translationService.setDefaultLang(this.translationService.getBrowserLang());
sessionStorage.setItem('currentLang', this.translationService.getBrowserLang());
}
title = 'ARSnova';
ngOnInit(): void {
this.update.available.subscribe(update => {
let install: string;
this.translationService.get('home-page.install').subscribe(msg => {
install = msg;
});
this.translationService.get('home-page.update-available').subscribe(msg => {
this.notification.show(msg, install, {
duration: 10000
});
});
this.notification.snackRef.afterDismissed().subscribe(info => {
if (info.dismissedByAction === true) {
window.location.reload();
}
});
});
}
}
......@@ -29,7 +29,9 @@
"no-empty-name": "Bitte geben Sie einen Namen ein",
"created-1": "Session '",
"created-2": "' erfolgreich erstellt",
"only-numbers": "Eine Session-ID besteht aus Ziffern"
"only-numbers": "Eine Session-ID besteht aus Ziffern",
"update-available": "Eine neue Version ist verfügbar.",
"install": "Installieren"
},
"login": {
"email": "E-mail",
......
......@@ -29,7 +29,9 @@
"no-empty-name": "Please enter a name.",
"created-1": "Session '",
"created-2": "' successfully created",
"only-numbers": "A session-ID only contains digits"
"only-numbers": "A session-ID only contains digits",
"update-available": "A newer version is available.",
"install": "Install"
},
"login": {
"email": "E-mail",
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment