first commit

This commit is contained in:
Bastian Wagner
2026-07-31 21:02:47 +02:00
commit 6bea4f766a
512 changed files with 64459 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
import { Component } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { environment } from './../environments/environment';
import { SwUpdate } from '@angular/service-worker';
import { MatIconRegistry } from '@angular/material/icon';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
version = environment.appVersion;
constructor(translate: TranslateService, updates: SwUpdate, iconRegistry: MatIconRegistry) {
iconRegistry.setDefaultFontSetClass('material-symbols-outlined');
translate.setDefaultLang('de');
translate.use('de');
this.update(updates);
}
update(updates: SwUpdate) {
console.log("Checking for updates: ", updates.isEnabled);
if (!updates.isEnabled) { return; }
updates.versionUpdates.subscribe(evt => {
switch (evt.type) {
case 'VERSION_DETECTED':
console.log(`Downloading new app version: ${evt.version.hash}`);
break;
case 'VERSION_READY':
console.log(`Current app version: ${evt.currentVersion.hash}`);
console.log(`New app version ready for use: ${evt.latestVersion.hash}`);
window.location.reload();
break;
case 'VERSION_INSTALLATION_FAILED':
console.log(`Failed to install app version '${evt.version.hash}': ${evt.error}`);
break;
case 'NO_NEW_VERSION_DETECTED':
break;
default:
}
});
}
}