From 4958994e71614f34b8d186783687550b3dc4369a Mon Sep 17 00:00:00 2001 From: Dean Campbell Date: Mon, 2 Nov 2020 19:32:40 -0800 Subject: [PATCH 01/13] Implement button to manually check for updates Included icon for indicating an application update is downloading. --- wowup-electron/app-updater.ts | 28 +++++++++++-- wowup-electron/main.ts | 2 +- wowup-electron/package.json | 2 + wowup-electron/src/app/app.component.ts | 12 +++--- .../components/footer/footer.component.html | 12 ++++++ .../components/footer/footer.component.scss | 37 +++++++++++++++++ .../app/components/footer/footer.component.ts | 19 +++++++++ .../app/services/electron/electron.service.ts | 11 +++++ .../src/app/services/icons/icon.service.ts | 24 +++++++++++ .../src/app/services/wowup/wowup.service.ts | 40 ++++++++++++++----- wowup-electron/src/assets/i18n/de.json | 1 + wowup-electron/src/assets/i18n/en.json | 1 + wowup-electron/src/assets/i18n/es.json | 1 + wowup-electron/src/assets/i18n/fr.json | 1 + wowup-electron/src/assets/i18n/it.json | 1 + wowup-electron/src/assets/i18n/ko.json | 1 + wowup-electron/src/assets/i18n/nb.json | 1 + wowup-electron/src/assets/i18n/pt.json | 1 + wowup-electron/src/assets/i18n/ru.json | 1 + wowup-electron/src/assets/i18n/zh.json | 1 + wowup-electron/src/common/constants.ts | 2 + .../src/common/wowup/system-tray-config.ts | 1 + wowup-electron/system-tray.ts | 7 ++++ 23 files changed, 189 insertions(+), 18 deletions(-) create mode 100644 wowup-electron/src/app/services/icons/icon.service.ts diff --git a/wowup-electron/app-updater.ts b/wowup-electron/app-updater.ts index 3750e63d..017409ba 100644 --- a/wowup-electron/app-updater.ts +++ b/wowup-electron/app-updater.ts @@ -1,9 +1,11 @@ import { BrowserWindow, ipcMain } from "electron"; import * as log from "electron-log"; -import { autoUpdater } from "electron-updater"; +import { autoUpdater, UpdateCheckResult } from "electron-updater"; import { APP_UPDATE_AVAILABLE, + APP_UPDATE_CHECK_END, APP_UPDATE_CHECK_FOR_UPDATE, + APP_UPDATE_CHECK_START, APP_UPDATE_DOWNLOADED, APP_UPDATE_ERROR, APP_UPDATE_INSTALL, @@ -11,6 +13,25 @@ import { APP_UPDATE_START_DOWNLOAD, } from "./src/common/constants"; +export const checkForUpdates = async function checkForUpdates( + win?: BrowserWindow +) { + win = win || BrowserWindow.getFocusedWindow(); + let result = {} as UpdateCheckResult; + try { + win.webContents.send(APP_UPDATE_CHECK_START); + result = await autoUpdater.checkForUpdates(); + } catch (err) {} + + await new Promise((resolve) => { + setTimeout(() => resolve(), 5000); + }); + + win.webContents.send(APP_UPDATE_CHECK_END); + return result; +}; + + // Example: https://github.com/electron-userland/electron-builder/blob/docs/encapsulated%20manual%20update%20via%20menu.js export function initializeAppUpdater(win: BrowserWindow) { autoUpdater.logger = log; @@ -39,9 +60,10 @@ export function initializeAppUpdater(win: BrowserWindow) { }); } -export function initializeAppUpdateIpcHandlers() { +export function initializeAppUpdateIpcHandlers(win: BrowserWindow) { ipcMain.handle(APP_UPDATE_START_DOWNLOAD, async () => { log.info(APP_UPDATE_START_DOWNLOAD); + win.webContents.send(APP_UPDATE_START_DOWNLOAD); return await autoUpdater.downloadUpdate(); }); @@ -52,6 +74,6 @@ export function initializeAppUpdateIpcHandlers() { ipcMain.handle(APP_UPDATE_CHECK_FOR_UPDATE, async () => { log.info(APP_UPDATE_CHECK_FOR_UPDATE); - return await autoUpdater.checkForUpdates(); + return await checkForUpdates(); }); } diff --git a/wowup-electron/main.ts b/wowup-electron/main.ts index 1f4c33a4..cdb5c479 100644 --- a/wowup-electron/main.ts +++ b/wowup-electron/main.ts @@ -173,7 +173,7 @@ function createWindow(): BrowserWindow { win = new BrowserWindow(windowOptions); initializeIpcHanders(win); initializeAppUpdater(win); - initializeAppUpdateIpcHandlers(); + initializeAppUpdateIpcHandlers(win); // Keep track of window state mainWindowManager.monitorState(win); diff --git a/wowup-electron/package.json b/wowup-electron/package.json index 8ff9ae84..92f80e2c 100644 --- a/wowup-electron/package.json +++ b/wowup-electron/package.json @@ -114,6 +114,8 @@ "@angular/animations": "~10.1.4", "@angular/cdk": "10.2.5", "@angular/material": "10.2.5", + "@fortawesome/fontawesome-svg-core": "1.2.32", + "@fortawesome/free-solid-svg-icons": "5.15.1", "@types/lodash": "4.14.162", "adm-zip": "0.4.16", "async": "3.2.0", diff --git a/wowup-electron/src/app/app.component.ts b/wowup-electron/src/app/app.component.ts index 0b874ceb..7fa4b1b3 100644 --- a/wowup-electron/src/app/app.component.ts +++ b/wowup-electron/src/app/app.component.ts @@ -5,8 +5,6 @@ import { } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; import { TranslateService } from "@ngx-translate/core"; -import { from } from "rxjs"; -import { switchMap } from "rxjs/operators"; import { CREATE_TRAY_MENU_CHANNEL } from "../common/constants"; import { SystemTrayConfig } from "../common/wowup/system-tray-config"; import { TelemetryDialogComponent } from "./components/telemetry-dialog/telemetry-dialog.component"; @@ -14,8 +12,9 @@ import { ElectronService } from "./services"; import { AddonService } from "./services/addons/addon.service"; import { AnalyticsService } from "./services/analytics/analytics.service"; import { FileService } from "./services/files/file.service"; -import { WarcraftService } from "./services/warcraft/warcraft.service"; import { WowUpService } from "./services/wowup/wowup.service"; +import { IconService } from "./services/icons/icon.service"; +import { faAngleDoubleDown } from "@fortawesome/free-solid-svg-icons"; const AUTO_UPDATE_PERIOD_MS = 60 * 60 * 1000; // 1 hour @@ -33,14 +32,16 @@ export class AppComponent implements AfterViewInit { private _electronService: ElectronService, private _fileService: FileService, private translate: TranslateService, - private warcraft: WarcraftService, private _wowUpService: WowUpService, private _dialog: MatDialog, - private _addonService: AddonService + private _addonService: AddonService, + private _iconService: IconService ) { this.translate.setDefaultLang("en"); this.translate.use(this._electronService.locale); + + this._iconService.addSvg(faAngleDoubleDown); } ngAfterViewInit(): void { @@ -105,6 +106,7 @@ export class AppComponent implements AfterViewInit { console.debug("Creating tray", result); const config: SystemTrayConfig = { quitLabel: result["APP.SYSTEM_TRAY.QUIT_ACTION"], + checkUpdateLabel: result["APP.SYSTEM_TRAY.CHECK_UPDATE"], showLabel: result["APP.SYSTEM_TRAY.SYSTEM_TRAY"], }; diff --git a/wowup-electron/src/app/components/footer/footer.component.html b/wowup-electron/src/app/components/footer/footer.component.html index 14941f17..ac4f0a29 100644 --- a/wowup-electron/src/app/components/footer/footer.component.html +++ b/wowup-electron/src/app/components/footer/footer.component.html @@ -32,6 +32,18 @@

{{ sessionService.pageContextText$ | async }}

v{{ wowUpService.applicationVersion }}

+
+ +
+
+ cached +
{{ listItem.addon.installedVersion }} + + ➤ {{ listItem.addon.latestVersion }} +
diff --git a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss index da1e2fbe..49e3955f 100644 --- a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss +++ b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss @@ -66,6 +66,10 @@ .addon-version { color: $white-2; + + .update-available { + color: $zak; + } } .addon-funding { diff --git a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.ts b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.ts index bd0ac009..2a2f58cc 100644 --- a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.ts +++ b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.ts @@ -8,6 +8,7 @@ import { AddonViewModel } from "../../business-objects/my-addon-list-item"; }) export class MyAddonsAddonCellComponent implements OnInit { @Input("addon") listItem: AddonViewModel; + @Input() showUpdateToVersion = false; @Output() onViewDetails: EventEmitter = new EventEmitter(); diff --git a/wowup-electron/src/app/pages/my-addons/my-addons.component.html b/wowup-electron/src/app/pages/my-addons/my-addons.component.html index 346cfad4..5cd722e5 100644 --- a/wowup-electron/src/app/pages/my-addons/my-addons.component.html +++ b/wowup-electron/src/app/pages/my-addons/my-addons.component.html @@ -131,6 +131,7 @@ @@ -179,7 +180,7 @@ {{ "PAGES.MY_ADDONS.TABLE.LATEST_VERSION_COLUMN_HEADER" | translate }} - + {{ element.addon.latestVersion }} @@ -307,7 +308,13 @@
{{ listItem.addon.name }}
-
{{ listItem.addon.latestVersion }}
+
{{ listItem.addon.installedVersion }}
+
+ {{ listItem.addon.latestVersion }} +
diff --git a/wowup-electron/src/app/pages/my-addons/my-addons.component.scss b/wowup-electron/src/app/pages/my-addons/my-addons.component.scss index ef4833b7..99e66469 100644 --- a/wowup-electron/src/app/pages/my-addons/my-addons.component.scss +++ b/wowup-electron/src/app/pages/my-addons/my-addons.component.scss @@ -86,6 +86,10 @@ white-space: pre-wrap; } + .addon-update-available { + color: $zak; + } + .game-version-cell { min-width: 110px; } diff --git a/wowup-electron/src/app/pages/my-addons/my-addons.component.ts b/wowup-electron/src/app/pages/my-addons/my-addons.component.ts index 9984c440..1831b99a 100644 --- a/wowup-electron/src/app/pages/my-addons/my-addons.component.ts +++ b/wowup-electron/src/app/pages/my-addons/my-addons.component.ts @@ -180,6 +180,10 @@ export class MyAddonsComponent implements OnInit, OnDestroy { this.subscriptions.forEach((sub) => sub.unsubscribe()); } + public isLatestUpdateColumnVisible(): boolean { + return this.columns.find(column => column.name === 'addon.latestVersion').visible + } + public onSortChange(): void { if (this.table) { this.table.nativeElement.scrollIntoView({ behavior: "smooth" }); diff --git a/wowup-electron/src/styles.scss b/wowup-electron/src/styles.scss index 3e444a21..ac570be8 100644 --- a/wowup-electron/src/styles.scss +++ b/wowup-electron/src/styles.scss @@ -298,6 +298,10 @@ img { .addon-version { color: $white-2; } + + .addon-update-available { + color: $zak; + } } } diff --git a/wowup-electron/src/variables.scss b/wowup-electron/src/variables.scss index 2e74cf74..186a4cd1 100644 --- a/wowup-electron/src/variables.scss +++ b/wowup-electron/src/variables.scss @@ -18,3 +18,5 @@ $white-4: #bbbbbb; $rare-color: #0070dd; $epic-color: #a335ee; + +$zak: #dbcc78; From e25b6cf3f375a8dbffc6264d4a95aa7f87f08ebc Mon Sep 17 00:00:00 2001 From: john liddell Date: Tue, 3 Nov 2020 14:40:11 -0600 Subject: [PATCH 06/13] sync the auto start values when the app starts --- wowup-electron/src/app/services/wowup/wowup.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wowup-electron/src/app/services/wowup/wowup.service.ts b/wowup-electron/src/app/services/wowup/wowup.service.ts index cfe603b1..a62380ef 100644 --- a/wowup-electron/src/app/services/wowup/wowup.service.ts +++ b/wowup-electron/src/app/services/wowup/wowup.service.ts @@ -84,6 +84,7 @@ export class WowUpService { this.applicationVersion.toLowerCase().indexOf("beta") != -1; this.createDownloadDirectory().then(() => this.cleanupDownloads()); + this.setAutoStartup(); } public get updaterExists() { @@ -347,7 +348,9 @@ export class WowUpService { isHidden: this.startMinimized, }); - if (this.startWithSystem) autoLauncher.enable(); + if (this.startWithSystem) { + autoLauncher.enable(); + } else autoLauncher.disable(); } else { this._electronService.remote.app.setLoginItemSettings({ From 800465d4a83f2fc71d5f36ca1161a4a77cebf2d9 Mon Sep 17 00:00:00 2001 From: john liddell Date: Tue, 3 Nov 2020 15:35:42 -0600 Subject: [PATCH 07/13] Handle startup hidden on mac --- wowup-electron/main.ts | 15 +++++++++++---- .../app/services/electron/electron.service.ts | 9 ++++++++- .../src/app/services/wowup/wowup.service.ts | 19 ++++++++----------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/wowup-electron/main.ts b/wowup-electron/main.ts index 1f4c33a4..ed9097cd 100644 --- a/wowup-electron/main.ts +++ b/wowup-electron/main.ts @@ -35,7 +35,7 @@ let win: BrowserWindow = null; // APP MENU SETUP const appMenuTemplate: Array< -MenuItemConstructorOptions | MenuItem + MenuItemConstructorOptions | MenuItem > = getAppMenu(); const appMenu = Menu.buildFromTemplate(appMenuTemplate); @@ -66,6 +66,10 @@ const argv = require("minimist")(process.argv.slice(1), { boolean: ["serve", "hidden"], }); +function canStartHidden() { + return argv.hidden || app.getLoginItemSettings().wasOpenedAsHidden; +} + function windowStateManager( windowName: string, { width, height }: { width: number; height: number } @@ -90,9 +94,9 @@ function windowStateManager( windowState.x >= display.bounds.x && windowState.y >= display.bounds.y && windowState.x + windowState.width <= - display.bounds.x + display.bounds.width && + display.bounds.x + display.bounds.width && windowState.y + windowState.height <= - display.bounds.y + display.bounds.height + display.bounds.y + display.bounds.height ); }); @@ -181,7 +185,10 @@ function createWindow(): BrowserWindow { win.webContents.userAgent = USER_AGENT; win.once("ready-to-show", () => { - if (!argv.hidden) win.show(); + if (canStartHidden()) { + return; + } + win.show(); }); win.once("show", () => { diff --git a/wowup-electron/src/app/services/electron/electron.service.ts b/wowup-electron/src/app/services/electron/electron.service.ts index 9bfee121..571edc7c 100644 --- a/wowup-electron/src/app/services/electron/electron.service.ts +++ b/wowup-electron/src/app/services/electron/electron.service.ts @@ -2,7 +2,7 @@ import { Injectable } from "@angular/core"; import * as childProcess from "child_process"; // If you import a module but never use any of the imported values other than as TypeScript types, // the resulting javascript file will look as if you never imported the module at all. -import { ipcRenderer, remote, shell, webFrame } from "electron"; +import { ipcRenderer, remote, Settings, shell, webFrame } from "electron"; import * as fs from "fs"; import { BehaviorSubject } from "rxjs"; import { v4 as uuidv4 } from "uuid"; @@ -39,6 +39,13 @@ export class ElectronService { return this.remote.app.getLocale().split("-")[0]; } + get loginItemSettings() { + return this.remote.app.getLoginItemSettings(); + } + set loginItemSettings(settings: Settings) { + this.remote.app.setLoginItemSettings(settings); + } + constructor() { // Conditional imports if (!this.isElectron) { diff --git a/wowup-electron/src/app/services/wowup/wowup.service.ts b/wowup-electron/src/app/services/wowup/wowup.service.ts index a62380ef..642b3434 100644 --- a/wowup-electron/src/app/services/wowup/wowup.service.ts +++ b/wowup-electron/src/app/services/wowup/wowup.service.ts @@ -25,15 +25,11 @@ import { AddonChannelType } from "../../models/wowup/addon-channel-type"; import { PreferenceChange } from "../../models/wowup/preference-change"; import { WowUpReleaseChannelType } from "../../models/wowup/wowup-release-channel-type"; import { getEnumList, getEnumName } from "../../utils/enum.utils"; -import { CachingService } from "../caching/caching-service"; -import { DownloadSevice } from "../download/download.service"; import { ElectronService } from "../electron/electron.service"; import { FileService } from "../files/file.service"; import { PreferenceStorageService } from "../storage/preference-storage.service"; -import { WowUpApiService } from "../wowup-api/wowup-api.service"; -const LATEST_VERSION_CACHE_KEY = "latest-version-response"; -var autoLaunch = require("auto-launch"); +const autoLaunch = require("auto-launch"); @Injectable({ providedIn: "root", @@ -71,11 +67,8 @@ export class WowUpService { constructor( private _preferenceStorageService: PreferenceStorageService, - private _downloadService: DownloadSevice, private _electronService: ElectronService, private _fileService: FileService, - private _cacheService: CachingService, - private _wowUpApiService: WowUpApiService ) { this.setDefaultPreferences(); @@ -85,6 +78,8 @@ export class WowUpService { this.createDownloadDirectory().then(() => this.cleanupDownloads()); this.setAutoStartup(); + + console.log('loginItemSettings', this._electronService.loginItemSettings); } public get updaterExists() { @@ -351,9 +346,11 @@ export class WowUpService { if (this.startWithSystem) { autoLauncher.enable(); } - else autoLauncher.disable(); + else { + autoLauncher.disable(); + } } else { - this._electronService.remote.app.setLoginItemSettings({ + this._electronService.loginItemSettings = { openAtLogin: this.startWithSystem, openAsHidden: this._electronService.isMac ? this.startMinimized : false, args: this._electronService.isWin @@ -361,7 +358,7 @@ export class WowUpService { ? ["--hidden"] : [] : [], - }); + }; } } From 8a91042356e8f9d13b558ceb029c8241eda398f2 Mon Sep 17 00:00:00 2001 From: jliddev Date: Tue, 3 Nov 2020 15:54:24 -0600 Subject: [PATCH 08/13] Update my-addons-addon-cell.component.html --- .../my-addons-addon-cell.component.html | 67 ++++++------------- 1 file changed, 20 insertions(+), 47 deletions(-) diff --git a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html index 70d273be..3594a700 100644 --- a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html +++ b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html @@ -1,70 +1,43 @@
-
+
{{ listItem.thumbnailLetter }}
-
+ }"> {{ listItem.isAlphaChannel ? "Alpha" : "Beta" }}
- {{ listItem.addon.name }} + {{ listItem.addon.name }} -
+
{{ listItem.addon.installedVersion }} - - ➤ {{ listItem.addon.latestVersion }} - +
+ play_arrow +
{{ listItem.addon.latestVersion }}
+
-
+
\ No newline at end of file From f67b2aa1561eeb1435c903679a8586b4143eb292 Mon Sep 17 00:00:00 2001 From: Lynn Date: Tue, 3 Nov 2020 23:03:11 +0100 Subject: [PATCH 09/13] $zak -> $artifact --- .../my-addons-addon-cell/my-addons-addon-cell.component.html | 2 +- .../my-addons-addon-cell/my-addons-addon-cell.component.scss | 2 +- wowup-electron/src/app/pages/my-addons/my-addons.component.scss | 2 +- wowup-electron/src/styles.scss | 2 +- wowup-electron/src/variables.scss | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html index 3594a700..8394c991 100644 --- a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html +++ b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.html @@ -40,4 +40,4 @@ - \ No newline at end of file + diff --git a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss index 49e3955f..1a148924 100644 --- a/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss +++ b/wowup-electron/src/app/components/my-addons-addon-cell/my-addons-addon-cell.component.scss @@ -68,7 +68,7 @@ color: $white-2; .update-available { - color: $zak; + color: $artifact; } } diff --git a/wowup-electron/src/app/pages/my-addons/my-addons.component.scss b/wowup-electron/src/app/pages/my-addons/my-addons.component.scss index 99e66469..963a0812 100644 --- a/wowup-electron/src/app/pages/my-addons/my-addons.component.scss +++ b/wowup-electron/src/app/pages/my-addons/my-addons.component.scss @@ -87,7 +87,7 @@ } .addon-update-available { - color: $zak; + color: $artifact; } .game-version-cell { diff --git a/wowup-electron/src/styles.scss b/wowup-electron/src/styles.scss index ac570be8..ee7a4e0b 100644 --- a/wowup-electron/src/styles.scss +++ b/wowup-electron/src/styles.scss @@ -300,7 +300,7 @@ img { } .addon-update-available { - color: $zak; + color: $artifact; } } } diff --git a/wowup-electron/src/variables.scss b/wowup-electron/src/variables.scss index 186a4cd1..1efe7c34 100644 --- a/wowup-electron/src/variables.scss +++ b/wowup-electron/src/variables.scss @@ -19,4 +19,4 @@ $white-4: #bbbbbb; $rare-color: #0070dd; $epic-color: #a335ee; -$zak: #dbcc78; +$artifact: #dbcc78; From 7b76568ed22b5b20adfe5edb8e1f302db119773f Mon Sep 17 00:00:00 2001 From: Dean Campbell Date: Tue, 3 Nov 2020 18:26:22 -0800 Subject: [PATCH 10/13] Implement requested changes --- wowup-electron/app-updater.ts | 9 ++++----- .../src/app/components/footer/footer.component.ts | 3 +++ .../src/app/services/electron/electron.service.ts | 8 ++++---- .../src/app/services/wowup/wowup.service.ts | 8 ++++---- wowup-electron/system-tray.ts | 14 +++++++------- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/wowup-electron/app-updater.ts b/wowup-electron/app-updater.ts index 2e50a0a7..3f65b091 100644 --- a/wowup-electron/app-updater.ts +++ b/wowup-electron/app-updater.ts @@ -1,6 +1,6 @@ import { BrowserWindow, ipcMain } from "electron"; import * as log from "electron-log"; -import { autoUpdater, UpdateCheckResult } from "electron-updater"; +import { autoUpdater } from "electron-updater"; import { APP_UPDATE_AVAILABLE, APP_UPDATE_CHECK_END, @@ -14,11 +14,10 @@ import { } from "./src/common/constants"; export const checkForUpdates = async function checkForUpdates( - win?: BrowserWindow + win: BrowserWindow ) { - win = win || BrowserWindow.getFocusedWindow(); - let result = {} as UpdateCheckResult; - + let result = null; + try { win.webContents.send(APP_UPDATE_CHECK_START); result = await autoUpdater.checkForUpdates(); diff --git a/wowup-electron/src/app/components/footer/footer.component.ts b/wowup-electron/src/app/components/footer/footer.component.ts index 8b307282..daecf656 100644 --- a/wowup-electron/src/app/components/footer/footer.component.ts +++ b/wowup-electron/src/app/components/footer/footer.component.ts @@ -65,6 +65,9 @@ export class FooterComponent implements OnInit { } public async onClickCheckForUpdates(): Promise { + if (this.isCheckingForUpdates) { + return; + } await this.wowUpService.checkForAppUpdate(); } diff --git a/wowup-electron/src/app/services/electron/electron.service.ts b/wowup-electron/src/app/services/electron/electron.service.ts index 986daf78..e4b2b1ab 100644 --- a/wowup-electron/src/app/services/electron/electron.service.ts +++ b/wowup-electron/src/app/services/electron/electron.service.ts @@ -18,7 +18,7 @@ import { ValueResponse } from "../../../common/models/value-response"; export class ElectronService { private readonly _windowMaximizedSrc = new BehaviorSubject(false); private readonly _windowMinimizedSrc = new BehaviorSubject(false); - private readonly _rendererEventSrc = new BehaviorSubject(''); + private readonly _ipcEventReceivedSrc = new BehaviorSubject(''); ipcRenderer: typeof ipcRenderer; webFrame: typeof webFrame; @@ -29,7 +29,7 @@ export class ElectronService { public readonly windowMaximized$ = this._windowMaximizedSrc.asObservable(); public readonly windowMinimized$ = this._windowMinimizedSrc.asObservable(); - public readonly renderedEventSrc$ = this._rendererEventSrc.asObservable(); + public readonly ipcEventReceived$ = this._ipcEventReceivedSrc.asObservable(); public readonly isWin = process.platform === "win32"; public readonly isMac = process.platform === "darwin"; public readonly isLinux = process.platform === "linux"; @@ -59,11 +59,11 @@ export class ElectronService { this.fs = window.require("fs"); this.ipcRenderer.on(APP_UPDATE_CHECK_START, () => { - this._rendererEventSrc.next(APP_UPDATE_CHECK_START); + this._ipcEventReceivedSrc.next(APP_UPDATE_CHECK_START); }); this.ipcRenderer.on(APP_UPDATE_CHECK_END, () => { - this._rendererEventSrc.next(APP_UPDATE_CHECK_END); + this._ipcEventReceivedSrc.next(APP_UPDATE_CHECK_END); }); const currentWindow = this.remote?.getCurrentWindow(); diff --git a/wowup-electron/src/app/services/wowup/wowup.service.ts b/wowup-electron/src/app/services/wowup/wowup.service.ts index 177c19b7..bc0a9861 100644 --- a/wowup-electron/src/app/services/wowup/wowup.service.ts +++ b/wowup-electron/src/app/services/wowup/wowup.service.ts @@ -84,7 +84,7 @@ export class WowUpService { this.createDownloadDirectory().then(() => this.cleanupDownloads()); - this._electronService.renderedEventSrc$.subscribe((evt) => { + this._electronService.ipcEventReceived$.subscribe((evt) => { switch (evt) { case APP_UPDATE_CHECK_START: console.log(APP_UPDATE_CHECK_START); @@ -266,9 +266,9 @@ export class WowUpService { // only notify things when the version changes if ( - updateCheckResult && - updateCheckResult.updateInfo && - updateCheckResult.updateInfo.version !== this._electronService.getVersionNumber() + updateCheckResult && + updateCheckResult.updateInfo?.version !== + this._electronService.getVersionNumber() ) { this._wowupUpdateCheckSrc.next(updateCheckResult); } diff --git a/wowup-electron/system-tray.ts b/wowup-electron/system-tray.ts index 29ff3cac..991c0de2 100644 --- a/wowup-electron/system-tray.ts +++ b/wowup-electron/system-tray.ts @@ -2,7 +2,6 @@ import { app, BrowserWindow, Menu, nativeImage, Tray } from "electron"; import * as path from "path"; import * as platform from "./platform"; import { SystemTrayConfig } from "./src/common/wowup/system-tray-config"; -import { checkForUpdates } from "./app-updater"; let _trayRef: Tray; @@ -34,12 +33,13 @@ export function createTray( } }, }, - { - label: config.showLabel || "Check for Updates...", - click: () => { - checkForUpdates(window); - }, - }, + // Removing this for now per discussion with zak + // { + // label: config.showLabel || "Check for Updates...", + // click: () => { + // checkForUpdates(window); + // }, + // }, { label: config.quitLabel || "Quit", role: "quit", From faeef587bf8bd884b4a7ba51561256f02a051a02 Mon Sep 17 00:00:00 2001 From: Dean Campbell Date: Tue, 3 Nov 2020 18:53:29 -0800 Subject: [PATCH 11/13] Add snackbar when no update is available --- .../app/components/footer/footer.component.ts | 17 +++++++++++++++-- wowup-electron/src/assets/i18n/de.json | 12 +++++++----- wowup-electron/src/assets/i18n/en.json | 13 +++++++------ wowup-electron/src/assets/i18n/es.json | 12 +++++++----- wowup-electron/src/assets/i18n/fr.json | 12 +++++++----- wowup-electron/src/assets/i18n/it.json | 12 +++++++----- wowup-electron/src/assets/i18n/ko.json | 12 +++++++----- wowup-electron/src/assets/i18n/nb.json | 12 +++++++----- wowup-electron/src/assets/i18n/pt.json | 12 +++++++----- wowup-electron/src/assets/i18n/ru.json | 12 +++++++----- wowup-electron/src/assets/i18n/zh.json | 12 +++++++----- wowup-electron/src/styles.scss | 9 +++++++++ 12 files changed, 94 insertions(+), 53 deletions(-) diff --git a/wowup-electron/src/app/components/footer/footer.component.ts b/wowup-electron/src/app/components/footer/footer.component.ts index daecf656..dc334ee2 100644 --- a/wowup-electron/src/app/components/footer/footer.component.ts +++ b/wowup-electron/src/app/components/footer/footer.component.ts @@ -1,5 +1,6 @@ import { ChangeDetectorRef, Component, NgZone, OnInit } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; +import { MatSnackBar } from "@angular/material/snack-bar"; import { TranslateService } from "@ngx-translate/core"; import { from } from "rxjs"; import { SessionService } from "../../services/session/session.service"; @@ -24,7 +25,8 @@ export class FooterComponent implements OnInit { private _zone: NgZone, private _cdRef: ChangeDetectorRef, public wowUpService: WowUpService, - public sessionService: SessionService + public sessionService: SessionService, + private _snackBar: MatSnackBar ) {} ngOnInit(): void { @@ -68,7 +70,18 @@ export class FooterComponent implements OnInit { if (this.isCheckingForUpdates) { return; } - await this.wowUpService.checkForAppUpdate(); + const result = await this.wowUpService.checkForAppUpdate(); + + if (result === null) { + this._snackBar.open( + this._translateService.instant("APP.WOWUP_UPDATE_NOT_AVAILABLE"), + null, + { + duration: 2000, + panelClass: 'center-text', + } + ); + } } public getUpdateIconTooltip() { diff --git a/wowup-electron/src/assets/i18n/de.json b/wowup-electron/src/assets/i18n/de.json index 99186870..d8db9e78 100644 --- a/wowup-electron/src/assets/i18n/de.json +++ b/wowup-electron/src/assets/i18n/de.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "WowUp Update installieren", "WOWUP_UPDATE_INSTALL_MESSAGE": "Willst du WowUp neu Starten um das Update zu installieren?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update bereit", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "Eine neue Version von WowUp ist verfügbar", "WOWUP_UPDATE_TOOLTIP": "WowUp Update verfügbar" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "Aktivieren / Deaktivieren verschiedener Systembenachrichtigungen", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "Systembenachrichtigungen aktivieren", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "Beim schließen WowUp in der Menübar minimieren", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Log-Dateien", "TITLE": "Debuggen" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Neu installierte Addons werden standardmäßig auf Auto-Update gesetzt", "AUTO_UPDATE_LABEL": "Automatisch aktualisieren", diff --git a/wowup-electron/src/assets/i18n/en.json b/wowup-electron/src/assets/i18n/en.json index d557f1c4..0a45a1f4 100644 --- a/wowup-electron/src/assets/i18n/en.json +++ b/wowup-electron/src/assets/i18n/en.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want to restart WowUp and install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "Enable various system notification popups, such as auto updated addons.", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "Enable system notifications", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "When closing the WowUp window, minimize to the menu bar.", @@ -198,7 +195,6 @@ "SET_LANGUAGE_CONFIRMATION_LABEL": "Setting a new default language", "SET_LANGUAGE_DESCRIPTION": "Select a language to change to", "SET_LANGUAGE_LABEL": "Set Language", - "CURRENT_LANGUAGE_LABEL": "Current Language", "START_MINIMIZED_DESCRIPTION": "WowUp will start minimized and not show up.", "START_MINIMIZED_LABEL": "Launch WowUp minimized", "START_WITH_SYSTEM_DESCRIPTION": "WowUp will be started automatically when you start up your system.", @@ -221,6 +217,11 @@ "LOG_FILES_LABEL": "Log Files", "TITLE": "Debug" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Newly installed addons will be set to auto update by default", "AUTO_UPDATE_LABEL": "Auto Update", diff --git a/wowup-electron/src/assets/i18n/es.json b/wowup-electron/src/assets/i18n/es.json index e040022d..120f73bd 100644 --- a/wowup-electron/src/assets/i18n/es.json +++ b/wowup-electron/src/assets/i18n/es.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "ENABLE_SYSTEM_NOTIFICATIONS_LABEL", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Archivos de Registro", "TITLE": "Depuración" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Los addons recién instalados se configurarán para actualizarse automáticamente de forma predeterminada", "AUTO_UPDATE_LABEL": "Actualización automática", diff --git a/wowup-electron/src/assets/i18n/fr.json b/wowup-electron/src/assets/i18n/fr.json index ae4ab58c..28f7f8e0 100644 --- a/wowup-electron/src/assets/i18n/fr.json +++ b/wowup-electron/src/assets/i18n/fr.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "ENABLE_SYSTEM_NOTIFICATIONS_LABEL", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Fichiers de log", "TITLE": "Déboguage" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Les extensions nouvellement installées seront mises à jour automatiquement par défaut", "AUTO_UPDATE_LABEL": "Mise à jour automatique", diff --git a/wowup-electron/src/assets/i18n/it.json b/wowup-electron/src/assets/i18n/it.json index 8493673c..61dc1a77 100644 --- a/wowup-electron/src/assets/i18n/it.json +++ b/wowup-electron/src/assets/i18n/it.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Installa l'aggiornamento di WowUp", "WOWUP_UPDATE_INSTALL_MESSAGE": "Vuoi riavviare WowUp per installare l'aggiornamento?", "WOWUP_UPDATE_INSTALL_TITLE": "Aggiornamento di Wowup pronto", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Aggiorna", "WOWUP_UPDATE_SNACKBAR_TEXT": "È disponibile una nuova versione di WowUp", "WOWUP_UPDATE_TOOLTIP": "L'aggiornamento di WowUp è pronto per l'installazione" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Applicazione", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "Abilita/Disabilita i vari popup di notifica del sistema, come gli addons aggiornati automaticamente", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "Abilita notifiche di sistema", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "Quando si chiude la finestra WowUp, minimizzare nella barra dei menu", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "File Di Log", "TITLE": "Debug" }, + "TABS": { + "APPLICATION": "Applicazione", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "I nuovi addons installati saranno impostati di default per l'aggiornamento automatico ", "AUTO_UPDATE_LABEL": "Aggiornamento Automatico", diff --git a/wowup-electron/src/assets/i18n/ko.json b/wowup-electron/src/assets/i18n/ko.json index 50878e92..23d28313 100644 --- a/wowup-electron/src/assets/i18n/ko.json +++ b/wowup-electron/src/assets/i18n/ko.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "Enable/Disable various system notification popups, such as auto updated addons.", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "Enable system notifications", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "When closing the WowUp window, minimize to the menu bar.", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Log Files", "TITLE": "Debug" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Newly installed addons will be set to auto update by default", "AUTO_UPDATE_LABEL": "Auto Update", diff --git a/wowup-electron/src/assets/i18n/nb.json b/wowup-electron/src/assets/i18n/nb.json index 2518adeb..f7081613 100644 --- a/wowup-electron/src/assets/i18n/nb.json +++ b/wowup-electron/src/assets/i18n/nb.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Installer oppdatering til WowUp", "WOWUP_UPDATE_INSTALL_MESSAGE": "Vil du restarte WowUp for å installere oppdateringen?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp-oppdatering er klar", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Oppdater", "WOWUP_UPDATE_SNACKBAR_TEXT": "en ny versjon av WowUp er tilgjengelig", "WOWUP_UPDATE_TOOLTIP": "WowUp oppdatering tilgjengelig" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "Aktiver/Deaktiver forskjellige systemvarsler, foreksempel: automatisk oppdatering av addons.", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "Aktiver systemvarsler", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "Når WowUp-vinduet lukkes, minimer til menylinjen.", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Loggfiler", "TITLE": "Debug" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Nye utvidelser du installerer vil bli satt til å oppdateres automatisk", "AUTO_UPDATE_LABEL": "Automatisk Oppdatering", diff --git a/wowup-electron/src/assets/i18n/pt.json b/wowup-electron/src/assets/i18n/pt.json index 17538426..a7e2f2ce 100644 --- a/wowup-electron/src/assets/i18n/pt.json +++ b/wowup-electron/src/assets/i18n/pt.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "ENABLE_SYSTEM_NOTIFICATIONS_LABEL", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Arquivos de Registro", "TITLE": "Depurar" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Addons recém-instalados serão definidos para atualizar automáticamente por padrão", "AUTO_UPDATE_LABEL": "Atualização Automática", diff --git a/wowup-electron/src/assets/i18n/ru.json b/wowup-electron/src/assets/i18n/ru.json index 8b9510a4..3e708d68 100644 --- a/wowup-electron/src/assets/i18n/ru.json +++ b/wowup-electron/src/assets/i18n/ru.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Установить обновление WowUp", "WOWUP_UPDATE_INSTALL_MESSAGE": "Вы хотите перезапустить WowUp чтобы установить обновление?", "WOWUP_UPDATE_INSTALL_TITLE": "Для WowUp готово обновление", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Обновить", "WOWUP_UPDATE_SNACKBAR_TEXT": "Доступна новая версия WowUp", "WOWUP_UPDATE_TOOLTIP": "Доступно обновление для WowUp" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Клиенты", - "APPLICATION": "Приложение", - "DEBUG": "Отладка" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "Включить различные окна системных уведомлений, такие как автоматически обновлённые модификации.", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "Включить системные уведомления", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "При закрытии окна WowUp сворачивается в меню статуса.", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "Файлы логов", "TITLE": "Отладка" }, + "TABS": { + "APPLICATION": "Приложение", + "CLIENTS": "Клиенты", + "DEBUG": "Отладка" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "Новые установленные модификации будут автоматически обновляться по умолчанию", "AUTO_UPDATE_LABEL": "Автообновление", diff --git a/wowup-electron/src/assets/i18n/zh.json b/wowup-electron/src/assets/i18n/zh.json index 43fc1fc0..db7fd8e1 100644 --- a/wowup-electron/src/assets/i18n/zh.json +++ b/wowup-electron/src/assets/i18n/zh.json @@ -10,6 +10,7 @@ "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", + "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" @@ -183,12 +184,8 @@ } }, "OPTIONS": { - "TABS": { - "CLIENTS": "Clients", - "APPLICATION": "Application", - "DEBUG": "Debug" - }, "APPLICATION": { + "CURRENT_LANGUAGE_LABEL": "Current Language", "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION": "ENABLE_SYSTEM_NOTIFICATIONS_DESCRIPTION", "ENABLE_SYSTEM_NOTIFICATIONS_LABEL": "ENABLE_SYSTEM_NOTIFICATIONS_LABEL", "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC": "MINIMIZE_ON_CLOSE_DESCRIPTION_MAC", @@ -220,6 +217,11 @@ "LOG_FILES_LABEL": "日志文件", "TITLE": "除错" }, + "TABS": { + "APPLICATION": "Application", + "CLIENTS": "Clients", + "DEBUG": "Debug" + }, "WOW": { "AUTO_UPDATE_DESCRIPTION": "新安装的插件将默认设置为自动更新", "AUTO_UPDATE_LABEL": "自动更新", diff --git a/wowup-electron/src/styles.scss b/wowup-electron/src/styles.scss index 3e444a21..2908f21f 100644 --- a/wowup-electron/src/styles.scss +++ b/wowup-electron/src/styles.scss @@ -408,3 +408,12 @@ img { } } } + +snack-bar-container { + &.center-text { + span { + margin: auto; + text-align: center; + } + } +} \ No newline at end of file From c201e7b55a21b716ff31c87de600f85fe7607eed Mon Sep 17 00:00:00 2001 From: jliddev Date: Wed, 4 Nov 2020 01:41:26 -0600 Subject: [PATCH 12/13] add error handling to the update check add some extra messages --- wowup-electron/app-updater.ts | 6 ++-- .../app/components/footer/footer.component.ts | 28 ++++++++++++------- .../src/app/services/wowup/wowup.service.ts | 16 +++++++---- wowup-electron/src/assets/i18n/de.json | 5 +++- wowup-electron/src/assets/i18n/en.json | 5 +++- wowup-electron/src/assets/i18n/es.json | 5 +++- wowup-electron/src/assets/i18n/fr.json | 5 +++- wowup-electron/src/assets/i18n/it.json | 5 +++- wowup-electron/src/assets/i18n/ko.json | 5 +++- wowup-electron/src/assets/i18n/nb.json | 5 +++- wowup-electron/src/assets/i18n/pt.json | 5 +++- wowup-electron/src/assets/i18n/ru.json | 5 +++- wowup-electron/src/assets/i18n/zh.json | 5 +++- wowup-electron/src/styles.scss | 6 +++- 14 files changed, 76 insertions(+), 30 deletions(-) diff --git a/wowup-electron/app-updater.ts b/wowup-electron/app-updater.ts index 3f65b091..cbab5d6e 100644 --- a/wowup-electron/app-updater.ts +++ b/wowup-electron/app-updater.ts @@ -21,13 +21,13 @@ export const checkForUpdates = async function checkForUpdates( try { win.webContents.send(APP_UPDATE_CHECK_START); result = await autoUpdater.checkForUpdates(); - } catch (err) {} + } finally { + win.webContents.send(APP_UPDATE_CHECK_END); + } - win.webContents.send(APP_UPDATE_CHECK_END); return result; }; - // Example: https://github.com/electron-userland/electron-builder/blob/docs/encapsulated%20manual%20update%20via%20menu.js export function initializeAppUpdater(win: BrowserWindow) { autoUpdater.logger = log; diff --git a/wowup-electron/src/app/components/footer/footer.component.ts b/wowup-electron/src/app/components/footer/footer.component.ts index dc334ee2..264b1cf4 100644 --- a/wowup-electron/src/app/components/footer/footer.component.ts +++ b/wowup-electron/src/app/components/footer/footer.component.ts @@ -2,6 +2,7 @@ import { ChangeDetectorRef, Component, NgZone, OnInit } from "@angular/core"; import { MatDialog } from "@angular/material/dialog"; import { MatSnackBar } from "@angular/material/snack-bar"; import { TranslateService } from "@ngx-translate/core"; +import { UpdateCheckResult } from "electron-updater"; import { from } from "rxjs"; import { SessionService } from "../../services/session/session.service"; import { WowUpService } from "../../services/wowup/wowup.service"; @@ -70,20 +71,27 @@ export class FooterComponent implements OnInit { if (this.isCheckingForUpdates) { return; } - const result = await this.wowUpService.checkForAppUpdate(); - if (result === null) { - this._snackBar.open( - this._translateService.instant("APP.WOWUP_UPDATE_NOT_AVAILABLE"), - null, - { - duration: 2000, - panelClass: 'center-text', - } - ); + let result: UpdateCheckResult = null; + try { + result = await this.wowUpService.checkForAppUpdate(); + + if (result === null || this.wowUpService.isSameVersion(result)) { + this.showSnackbar("APP.WOWUP_UPDATE.NOT_AVAILABLE"); + } + } catch (e) { + console.error(e); + this.showSnackbar("APP.WOWUP_UPDATE.UPDATE_ERROR", ["error-text"]); } } + private showSnackbar(localeKey: string, classes: string[] = []) { + this._snackBar.open(this._translateService.instant(localeKey), null, { + duration: 2000, + panelClass: ["center-text", ...classes], + }); + } + public getUpdateIconTooltip() { if (this.isWowUpUpdateDownloaded) { return "APP.WOWUP_UPDATE_DOWNLOADED_TOOLTIP"; diff --git a/wowup-electron/src/app/services/wowup/wowup.service.ts b/wowup-electron/src/app/services/wowup/wowup.service.ts index bc0a9861..980b0aac 100644 --- a/wowup-electron/src/app/services/wowup/wowup.service.ts +++ b/wowup-electron/src/app/services/wowup/wowup.service.ts @@ -74,7 +74,7 @@ export class WowUpService { constructor( private _preferenceStorageService: PreferenceStorageService, private _electronService: ElectronService, - private _fileService: FileService, + private _fileService: FileService ) { this.setDefaultPreferences(); @@ -265,17 +265,21 @@ export class WowUpService { ); // only notify things when the version changes - if ( - updateCheckResult && - updateCheckResult.updateInfo?.version !== - this._electronService.getVersionNumber() - ) { + if (!this.isSameVersion(updateCheckResult)) { this._wowupUpdateCheckSrc.next(updateCheckResult); } return updateCheckResult; } + public isSameVersion(updateCheckResult: UpdateCheckResult) { + return ( + updateCheckResult && + updateCheckResult.updateInfo?.version === + this._electronService.getVersionNumber() + ); + } + public async downloadUpdate() { const downloadResult = await this._electronService.invoke( APP_UPDATE_START_DOWNLOAD diff --git a/wowup-electron/src/assets/i18n/de.json b/wowup-electron/src/assets/i18n/de.json index d8db9e78..9699d7eb 100644 --- a/wowup-electron/src/assets/i18n/de.json +++ b/wowup-electron/src/assets/i18n/de.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Beenden", "SHOW_ACTION": "Öffnen" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "WowUp Update installieren", "WOWUP_UPDATE_INSTALL_MESSAGE": "Willst du WowUp neu Starten um das Update zu installieren?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update bereit", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "Eine neue Version von WowUp ist verfügbar", "WOWUP_UPDATE_TOOLTIP": "WowUp Update verfügbar" diff --git a/wowup-electron/src/assets/i18n/en.json b/wowup-electron/src/assets/i18n/en.json index 0a45a1f4..beb71564 100644 --- a/wowup-electron/src/assets/i18n/en.json +++ b/wowup-electron/src/assets/i18n/en.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want to restart WowUp and install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" diff --git a/wowup-electron/src/assets/i18n/es.json b/wowup-electron/src/assets/i18n/es.json index 120f73bd..e0d836e1 100644 --- a/wowup-electron/src/assets/i18n/es.json +++ b/wowup-electron/src/assets/i18n/es.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" diff --git a/wowup-electron/src/assets/i18n/fr.json b/wowup-electron/src/assets/i18n/fr.json index 28f7f8e0..84b6a572 100644 --- a/wowup-electron/src/assets/i18n/fr.json +++ b/wowup-electron/src/assets/i18n/fr.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" diff --git a/wowup-electron/src/assets/i18n/it.json b/wowup-electron/src/assets/i18n/it.json index 61dc1a77..f4b01999 100644 --- a/wowup-electron/src/assets/i18n/it.json +++ b/wowup-electron/src/assets/i18n/it.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Chiudi", "SHOW_ACTION": "Mostra" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Installa l'aggiornamento di WowUp", "WOWUP_UPDATE_INSTALL_MESSAGE": "Vuoi riavviare WowUp per installare l'aggiornamento?", "WOWUP_UPDATE_INSTALL_TITLE": "Aggiornamento di Wowup pronto", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Aggiorna", "WOWUP_UPDATE_SNACKBAR_TEXT": "È disponibile una nuova versione di WowUp", "WOWUP_UPDATE_TOOLTIP": "L'aggiornamento di WowUp è pronto per l'installazione" diff --git a/wowup-electron/src/assets/i18n/ko.json b/wowup-electron/src/assets/i18n/ko.json index 23d28313..e84639e5 100644 --- a/wowup-electron/src/assets/i18n/ko.json +++ b/wowup-electron/src/assets/i18n/ko.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" diff --git a/wowup-electron/src/assets/i18n/nb.json b/wowup-electron/src/assets/i18n/nb.json index f7081613..16b0abe1 100644 --- a/wowup-electron/src/assets/i18n/nb.json +++ b/wowup-electron/src/assets/i18n/nb.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Installer oppdatering til WowUp", "WOWUP_UPDATE_INSTALL_MESSAGE": "Vil du restarte WowUp for å installere oppdateringen?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp-oppdatering er klar", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Oppdater", "WOWUP_UPDATE_SNACKBAR_TEXT": "en ny versjon av WowUp er tilgjengelig", "WOWUP_UPDATE_TOOLTIP": "WowUp oppdatering tilgjengelig" diff --git a/wowup-electron/src/assets/i18n/pt.json b/wowup-electron/src/assets/i18n/pt.json index a7e2f2ce..7e377bc6 100644 --- a/wowup-electron/src/assets/i18n/pt.json +++ b/wowup-electron/src/assets/i18n/pt.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" diff --git a/wowup-electron/src/assets/i18n/ru.json b/wowup-electron/src/assets/i18n/ru.json index 3e708d68..9d9b7f6e 100644 --- a/wowup-electron/src/assets/i18n/ru.json +++ b/wowup-electron/src/assets/i18n/ru.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Выход", "SHOW_ACTION": "Показать" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Установить обновление WowUp", "WOWUP_UPDATE_INSTALL_MESSAGE": "Вы хотите перезапустить WowUp чтобы установить обновление?", "WOWUP_UPDATE_INSTALL_TITLE": "Для WowUp готово обновление", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Обновить", "WOWUP_UPDATE_SNACKBAR_TEXT": "Доступна новая версия WowUp", "WOWUP_UPDATE_TOOLTIP": "Доступно обновление для WowUp" diff --git a/wowup-electron/src/assets/i18n/zh.json b/wowup-electron/src/assets/i18n/zh.json index db7fd8e1..f8475144 100644 --- a/wowup-electron/src/assets/i18n/zh.json +++ b/wowup-electron/src/assets/i18n/zh.json @@ -7,10 +7,13 @@ "QUIT_ACTION": "Quit", "SHOW_ACTION": "Show" }, + "WOWUP_UPDATE": { + "NOT_AVAILABLE": "Latest version of WowUp is already installed", + "UPDATE_ERROR": "Failed to get WowUp update" + }, "WOWUP_UPDATE_DOWNLOADED_TOOLTIP": "Install WowUp update", "WOWUP_UPDATE_INSTALL_MESSAGE": "Do you want restart WowUp to install the update?", "WOWUP_UPDATE_INSTALL_TITLE": "WowUp Update Ready", - "WOWUP_UPDATE_NOT_AVAILABLE": "Latest version of WowUp is already installed", "WOWUP_UPDATE_SNACKBAR_ACTION": "Update", "WOWUP_UPDATE_SNACKBAR_TEXT": "A new version of WowUp is available", "WOWUP_UPDATE_TOOLTIP": "WowUp update available" diff --git a/wowup-electron/src/styles.scss b/wowup-electron/src/styles.scss index 2908f21f..66dc7714 100644 --- a/wowup-electron/src/styles.scss +++ b/wowup-electron/src/styles.scss @@ -401,6 +401,10 @@ img { } } +.error-text { + color: red; +} + .no-tabs { &.mat-tab-group { .mat-tab-header { @@ -416,4 +420,4 @@ snack-bar-container { text-align: center; } } -} \ No newline at end of file +} From ec6a3071ba9bbe13520108ebc923e2e2052af771 Mon Sep 17 00:00:00 2001 From: jliddev Date: Wed, 4 Nov 2020 10:20:40 -0600 Subject: [PATCH 13/13] Tweak the wowup download button --- .../src/app/components/footer/footer.component.scss | 7 ++++--- wowup-electron/src/app/mat-module.ts | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wowup-electron/src/app/components/footer/footer.component.scss b/wowup-electron/src/app/components/footer/footer.component.scss index b26a061f..b17bd2aa 100644 --- a/wowup-electron/src/app/components/footer/footer.component.scss +++ b/wowup-electron/src/app/components/footer/footer.component.scss @@ -51,13 +51,14 @@ footer { height: 25px; padding: 0 0.5em; overflow: hidden; - background-color: green; + color: green; border-radius: 4px; border: none; - color: $white-1; + background-color: $dark-4; + // color: $white-1; &:hover { - background-color: darkgreen; + background-color: $dark-3; cursor: pointer; } diff --git a/wowup-electron/src/app/mat-module.ts b/wowup-electron/src/app/mat-module.ts index 80c8df16..f6e2d1ea 100644 --- a/wowup-electron/src/app/mat-module.ts +++ b/wowup-electron/src/app/mat-module.ts @@ -20,6 +20,7 @@ import { MatTabsModule } from "@angular/material/tabs"; import { MatTooltipModule } from "@angular/material/tooltip"; import { MatSidenavModule } from "@angular/material/sidenav"; import { MatListModule } from "@angular/material/list"; +import { MatBadgeModule } from "@angular/material/badge"; @NgModule({ exports: [ @@ -44,6 +45,7 @@ import { MatListModule } from "@angular/material/list"; MatSnackBarModule, MatSidenavModule, MatListModule, + MatBadgeModule, ], imports: [ MatSliderModule, @@ -67,6 +69,7 @@ import { MatListModule } from "@angular/material/list"; MatSnackBarModule, MatSidenavModule, MatListModule, + MatBadgeModule, ], }) export class MatModule {}