added check updates link

This commit is contained in:
Nicolas Constant 2020-03-07 11:01:20 -05:00
parent 4d461b497e
commit b17f2742a4
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
3 changed files with 23 additions and 18 deletions

View File

@ -58,6 +58,7 @@
<p class="version">
Sengi version: {{version}}<br/>
<a href class="version__link" (click)="checkForUpdates()">check for updates</a>
<app-waiting-animation *ngIf="isCheckingUpdates" class="waiting-icon"></app-waiting-animation>
</p>

View File

@ -14,7 +14,7 @@ import { ServiceWorkerService } from '../../../services/service-worker.service';
})
export class SettingsComponent implements OnInit {
notificationSounds: NotificationSoundDefinition[];
notificationSoundId: string;
notificationForm: FormGroup;
@ -36,7 +36,7 @@ export class SettingsComponent implements OnInit {
ngOnInit() {
this.version = environment.VERSION;
const settings = this.toolsService.getSettings();
const settings = this.toolsService.getSettings();
this.notificationSounds = this.userNotificationsService.getAllNotificationSounds();
this.notificationSoundId = settings.notificationSoundFileId;
@ -48,18 +48,18 @@ export class SettingsComponent implements OnInit {
this.disableAvatarNotificationsEnabled = settings.disableAvatarNotifications;
this.disableSoundsEnabled = settings.disableSounds;
if(!settings.columnSwitchingWinAlt){
if (!settings.columnSwitchingWinAlt) {
this.columnShortcutEnabled = ColumnShortcut.Ctrl;
} else {
this.columnShortcutEnabled = ColumnShortcut.Win;
}
}
onShortcutChange(id: ColumnShortcut){
onShortcutChange(id: ColumnShortcut) {
this.columnShortcutEnabled = id;
this.columnShortcutChanged = true;
let settings = this.toolsService.getSettings()
let settings = this.toolsService.getSettings()
settings.columnSwitchingWinAlt = id === ColumnShortcut.Win;
this.toolsService.saveSettings(settings);
}
@ -87,19 +87,19 @@ export class SettingsComponent implements OnInit {
return false;
}
onDisableAutofocusChanged(){
onDisableAutofocusChanged() {
let settings = this.toolsService.getSettings();
settings.disableAutofocus = this.disableAutofocusEnabled;
this.toolsService.saveSettings(settings);
this.toolsService.saveSettings(settings);
}
onDisableAvatarNotificationsChanged(){
onDisableAvatarNotificationsChanged() {
let settings = this.toolsService.getSettings();
settings.disableAvatarNotifications = this.disableAvatarNotificationsEnabled;
this.toolsService.saveSettings(settings);
}
onDisableSoundsEnabledChanged(){
onDisableSoundsEnabledChanged() {
let settings = this.toolsService.getSettings();
settings.disableSounds = this.disableSoundsEnabled;
this.toolsService.saveSettings(settings);
@ -111,7 +111,7 @@ export class SettingsComponent implements OnInit {
return false;
}
confirmClearAll(): boolean{
confirmClearAll(): boolean {
localStorage.clear();
location.reload();
return false;
@ -122,14 +122,22 @@ export class SettingsComponent implements OnInit {
return false;
}
isCheckingUpdates = false;
checkForUpdates(): boolean {
this.serviceWorkersService.checkForUpdates();
this.isCheckingUpdates = true;
this.serviceWorkersService.checkForUpdates()
.catch(err => {
console.error(err);
})
.then(() => {
this.isCheckingUpdates = false;
});
return false;
}
}
enum ColumnShortcut {
Ctrl = 1,
Ctrl = 1,
Win = 2
}

View File

@ -46,11 +46,7 @@ export class ServiceWorkerService {
document.location.reload();
}
checkForUpdates(): any {
console.log("Check for update");
this.updates.checkForUpdate()
.catch(err => {
console.error(err);
});
checkForUpdates(): Promise<void> {
return this.updates.checkForUpdate();
}
}