From c2c1944269d3d154443e5cf3726dc0d476e8aaff Mon Sep 17 00:00:00 2001 From: john liddell Date: Fri, 11 Sep 2020 22:53:30 -0500 Subject: [PATCH] small mac change --- .../titlebar/titlebar.component.html | 2 +- .../storage/preference-storage.service.ts | 10 +++---- .../src/app/services/wowup/wowup.service.ts | 30 +++++++++++++++---- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/wowup-electron/src/app/components/titlebar/titlebar.component.html b/wowup-electron/src/app/components/titlebar/titlebar.component.html index 6771fd83..6d1777cf 100644 --- a/wowup-electron/src/app/components/titlebar/titlebar.component.html +++ b/wowup-electron/src/app/components/titlebar/titlebar.component.html @@ -1,6 +1,6 @@
-
+
diff --git a/wowup-electron/src/app/services/storage/preference-storage.service.ts b/wowup-electron/src/app/services/storage/preference-storage.service.ts index 2235dee1..f416a761 100644 --- a/wowup-electron/src/app/services/storage/preference-storage.service.ts +++ b/wowup-electron/src/app/services/storage/preference-storage.service.ts @@ -21,17 +21,15 @@ export class PreferenceStorageService { return action(this._store); } - public set(key: string, value: string) { - this._store.set(key, value); + public set(key: string, value: any) { + this._store.set(key, value.toString()); } public get(key: string): Addon { return this._store.get(key) as Addon; } - public findByKey(key: string){ - console.log(this._store) - - return this._store.get(key); + public findByKey(key: string): string{ + return this._store.get(key) as string; } } \ No newline at end of file diff --git a/wowup-electron/src/app/services/wowup/wowup.service.ts b/wowup-electron/src/app/services/wowup/wowup.service.ts index 29d662eb..420c49c4 100644 --- a/wowup-electron/src/app/services/wowup/wowup.service.ts +++ b/wowup-electron/src/app/services/wowup/wowup.service.ts @@ -16,6 +16,7 @@ const WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY = 'wowup_release_channel'; const DEFAULT_CHANNEL_PREFERENCE_KEY_SUFFIX = '_default_addon_channel'; const TELEMETRY_ENABLED_PREFERENCE_KEY = 'telemetry_enabled'; const TELEMETRY_PROMPT_SENT_PREFERENCE_KEY = 'telemetry_prompt_sent'; +const LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY = 'last_selected_client_type'; @Injectable({ providedIn: 'root' @@ -45,7 +46,7 @@ export class WowUpService { } public set collapseToTray(value: boolean) { - this._preferenceStorageService.set(COLLAPSE_TO_TRAY_PREFERENCE_KEY, value.toString()); + this._preferenceStorageService.set(COLLAPSE_TO_TRAY_PREFERENCE_KEY, value); } public get telemetryEnabled() { @@ -54,17 +55,34 @@ export class WowUpService { } public set telemetryEnabled(value: boolean) { - this._preferenceStorageService.set(TELEMETRY_ENABLED_PREFERENCE_KEY, value.toString()); + this._preferenceStorageService.set(TELEMETRY_ENABLED_PREFERENCE_KEY, value); + } + + public get wowUpReleaseChannel() { + const preference = this._preferenceStorageService.findByKey(WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY); + return parseInt(preference, 10) as WowUpReleaseChannelType; + } + + public set wowUpReleaseChannel(releaseChannel: WowUpReleaseChannelType) { + this._preferenceStorageService.set(WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY, releaseChannel); + } + + public get lastSelectedClientType(): WowClientType { + const preference = this._preferenceStorageService.findByKey(LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY); + const value = parseInt(preference, 10); + return isNaN(value) + ? WowClientType.None + : value as WowClientType; + } + + public set lastSelectedClientType(clientType: WowClientType) { + this._preferenceStorageService.set(LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY, clientType); } public showLogsFolder() { this._electronService.shell.openExternal(this.applicationLogsFolderPath, { activate: true }); } - public setCollapseToTray(enabled: boolean) { - this._preferenceStorageService.set(COLLAPSE_TO_TRAY_PREFERENCE_KEY, enabled.toString()) - } - private setDefaultPreference(key: string, defaultValue: any) { let pref = this._preferenceStorageService.findByKey(key); if (!pref) {