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"> <p class="version">
Sengi version: {{version}}<br/> Sengi version: {{version}}<br/>
<a href class="version__link" (click)="checkForUpdates()">check for updates</a> <a href class="version__link" (click)="checkForUpdates()">check for updates</a>
<app-waiting-animation *ngIf="isCheckingUpdates" class="waiting-icon"></app-waiting-animation>
</p> </p>

View File

@ -36,7 +36,7 @@ export class SettingsComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.version = environment.VERSION; this.version = environment.VERSION;
const settings = this.toolsService.getSettings(); const settings = this.toolsService.getSettings();
this.notificationSounds = this.userNotificationsService.getAllNotificationSounds(); this.notificationSounds = this.userNotificationsService.getAllNotificationSounds();
this.notificationSoundId = settings.notificationSoundFileId; this.notificationSoundId = settings.notificationSoundFileId;
@ -48,14 +48,14 @@ export class SettingsComponent implements OnInit {
this.disableAvatarNotificationsEnabled = settings.disableAvatarNotifications; this.disableAvatarNotificationsEnabled = settings.disableAvatarNotifications;
this.disableSoundsEnabled = settings.disableSounds; this.disableSoundsEnabled = settings.disableSounds;
if(!settings.columnSwitchingWinAlt){ if (!settings.columnSwitchingWinAlt) {
this.columnShortcutEnabled = ColumnShortcut.Ctrl; this.columnShortcutEnabled = ColumnShortcut.Ctrl;
} else { } else {
this.columnShortcutEnabled = ColumnShortcut.Win; this.columnShortcutEnabled = ColumnShortcut.Win;
} }
} }
onShortcutChange(id: ColumnShortcut){ onShortcutChange(id: ColumnShortcut) {
this.columnShortcutEnabled = id; this.columnShortcutEnabled = id;
this.columnShortcutChanged = true; this.columnShortcutChanged = true;
@ -87,19 +87,19 @@ export class SettingsComponent implements OnInit {
return false; return false;
} }
onDisableAutofocusChanged(){ onDisableAutofocusChanged() {
let settings = this.toolsService.getSettings(); let settings = this.toolsService.getSettings();
settings.disableAutofocus = this.disableAutofocusEnabled; settings.disableAutofocus = this.disableAutofocusEnabled;
this.toolsService.saveSettings(settings); this.toolsService.saveSettings(settings);
} }
onDisableAvatarNotificationsChanged(){ onDisableAvatarNotificationsChanged() {
let settings = this.toolsService.getSettings(); let settings = this.toolsService.getSettings();
settings.disableAvatarNotifications = this.disableAvatarNotificationsEnabled; settings.disableAvatarNotifications = this.disableAvatarNotificationsEnabled;
this.toolsService.saveSettings(settings); this.toolsService.saveSettings(settings);
} }
onDisableSoundsEnabledChanged(){ onDisableSoundsEnabledChanged() {
let settings = this.toolsService.getSettings(); let settings = this.toolsService.getSettings();
settings.disableSounds = this.disableSoundsEnabled; settings.disableSounds = this.disableSoundsEnabled;
this.toolsService.saveSettings(settings); this.toolsService.saveSettings(settings);
@ -111,7 +111,7 @@ export class SettingsComponent implements OnInit {
return false; return false;
} }
confirmClearAll(): boolean{ confirmClearAll(): boolean {
localStorage.clear(); localStorage.clear();
location.reload(); location.reload();
return false; return false;
@ -122,8 +122,16 @@ export class SettingsComponent implements OnInit {
return false; return false;
} }
isCheckingUpdates = false;
checkForUpdates(): boolean { checkForUpdates(): boolean {
this.serviceWorkersService.checkForUpdates(); this.isCheckingUpdates = true;
this.serviceWorkersService.checkForUpdates()
.catch(err => {
console.error(err);
})
.then(() => {
this.isCheckingUpdates = false;
});
return false; return false;
} }
} }

View File

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