fix crash bug for published builds

This commit is contained in:
jliddev
2020-10-20 01:29:39 -05:00
parent cc5f79e5d0
commit f426f20bd1
10 changed files with 104 additions and 108 deletions

View File

@@ -23,9 +23,9 @@ import { Subject } from "rxjs";
import { debounceTime } from "rxjs/operators";
import { IpcHandler } from "./ipc-events";
import {
collapseToTrayKey,
useHardwareAccelerationKey,
} from "./src/constants";
COLLAPSE_TO_TRAY_PREFERENCE_KEY,
USE_HARDWARE_ACCELERATION_PREFERENCE_KEY,
} from "./src/common/constants";
const isMac = process.platform === "darwin";
const isWin = process.platform === "win32";
@@ -47,49 +47,49 @@ autoUpdater.on("update-downloaded", () => {
const appMenuTemplate: Array<MenuItemConstructorOptions | MenuItem> = isMac
? [
{
label: app.name,
submenu: [{ role: "quit" }],
},
{
label: "Edit",
submenu: [
{ role: "undo" },
{ role: "redo" },
{ type: "separator" },
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
{ role: "selectAll" },
],
},
{
label: "View",
submenu: [
{ role: "reload" },
{ role: "forceReload" },
{ role: "toggleDevTools" },
{ type: "separator" },
{ role: "resetZoom" },
{ role: "zoomIn", accelerator: "CommandOrControl+=" },
{ role: "zoomOut" },
{ type: "separator" },
{ role: "togglefullscreen" },
],
},
]
{
label: app.name,
submenu: [{ role: "quit" }],
},
{
label: "Edit",
submenu: [
{ role: "undo" },
{ role: "redo" },
{ type: "separator" },
{ role: "cut" },
{ role: "copy" },
{ role: "paste" },
{ role: "selectAll" },
],
},
{
label: "View",
submenu: [
{ role: "reload" },
{ role: "forceReload" },
{ role: "toggleDevTools" },
{ type: "separator" },
{ role: "resetZoom" },
{ role: "zoomIn", accelerator: "CommandOrControl+=" },
{ role: "zoomOut" },
{ type: "separator" },
{ role: "togglefullscreen" },
],
},
]
: [
{
label: "View",
submenu: [
{ role: "resetZoom" },
{ role: "zoomIn", accelerator: "CommandOrControl+=" },
{ role: "zoomOut" },
{ type: "separator" },
{ role: "togglefullscreen" },
],
},
];
{
label: "View",
submenu: [
{ role: "resetZoom" },
{ role: "zoomIn", accelerator: "CommandOrControl+=" },
{ role: "zoomOut" },
{ type: "separator" },
{ role: "togglefullscreen" },
],
},
];
const appMenu = Menu.buildFromTemplate(appMenuTemplate);
Menu.setApplicationMenu(appMenu);
@@ -105,7 +105,7 @@ log.transports.file.resolvePath = (
};
log.info("Main starting");
if (preferenceStore.get(useHardwareAccelerationKey) === "false") {
if (preferenceStore.get(USE_HARDWARE_ACCELERATION_PREFERENCE_KEY) === "false") {
log.info("Hardware acceleration disabled");
app.disableHardwareAcceleration();
} else {
@@ -181,9 +181,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
);
});
@@ -293,7 +293,7 @@ function createWindow(): BrowserWindow {
e.preventDefault();
win.hide();
if (preferenceStore.get(collapseToTrayKey) === "true") {
if (preferenceStore.get(COLLAPSE_TO_TRAY_PREFERENCE_KEY) === "true") {
app.dock.hide();
}
});
@@ -397,4 +397,3 @@ try {
// Catch Error
// throw e;
}

View File

@@ -1,7 +1,7 @@
{
"name": "wowup",
"productName": "WowUp",
"version": "2.0.0-alpha.12",
"version": "2.0.0-alpha.13",
"description": "Word of Warcraft addon updater",
"homepage": "https://github.com/maximegris/angular-electron",
"author": {

View File

@@ -14,8 +14,6 @@ import { ElectronService } from "app/services";
import { AppCurseScanResult } from "../models/curse/app-curse-scan-result";
import { v4 as uuidv4 } from "uuid";
import { CURSE_GET_SCAN_RESULTS } from "common/constants";
import { CurseGetScanResultsRequest } from "common/curse/curse-get-scan-results-request";
import { CurseGetScanResultsResponse } from "common/curse/curse-get-scan-results-response";
import { CurseMatch } from "common/curse/curse-match";
import { CurseFingerprintsResponse } from "../models/curse/curse-fingerprint-response";
import { CurseSearchResult } from "../../common/curse/curse-search-result";

View File

@@ -5,11 +5,9 @@ import { v4 as uuidv4 } from "uuid";
import { Addon } from "../entities/addon";
import { WowClientType } from "../models/warcraft/wow-client-type";
import { AddonSearchResult } from "../models/wowup/addon-search-result";
import { AddonProvider, AddonProviderType } from "./addon-provider";
import { AddonProvider } from "./addon-provider";
import { WowUpAddonRepresentation } from "../models/wowup-api/wowup-addon.representation";
import { AddonFolder } from "app/models/wowup/addon-folder";
import { WowUpGetScanResultsRequest } from "common/wowup/wowup-get-scan-results-request";
import { WowUpGetScanResultsResponse } from "common/wowup/wowup-get-scan-results-response";
import { ElectronService } from "app/services";
import { WOWUP_GET_SCAN_RESULTS } from "common/constants";
import { WowUpScanResult } from "common/wowup/wowup-scan-result";

View File

@@ -11,7 +11,6 @@ import { WowClientType } from "app/models/warcraft/wow-client-type";
import { ElectronService } from "app/services";
import { WarcraftService } from "app/services/warcraft/warcraft.service";
import { WowUpService } from "app/services/wowup/wowup.service";
import { filter, map } from "rxjs/operators";
import * as _ from "lodash";
import * as path from "path";
import { MatDialog } from "@angular/material/dialog";
@@ -21,7 +20,6 @@ import { WowUpReleaseChannelType } from "app/models/wowup/wowup-release-channel-
import { MatSelectChange } from "@angular/material/select";
import { AnalyticsService } from "app/services/analytics/analytics.service";
import { AddonService } from "app/services/addons/addon.service";
import { GET_ASSET_FILE_PATH } from "common/constants";
import { ConfirmDialogComponent } from "../../components/confirm-dialog/confirm-dialog.component";
import { TranslateService } from "@ngx-translate/core";
@@ -110,29 +108,32 @@ export class OptionsComponent implements OnInit, OnChanges {
onEnableSystemNotifications = (evt: MatSlideToggleChange) => {
this.wowupService.enableSystemNotifications = evt.checked;
}
};
onUseHardwareAccelerationChange = (evt: MatSlideToggleChange) => {
const dialogRef = this._dialog.open(ConfirmDialogComponent, {
data: {
title: this._translateService.instant('PAGES.OPTIONS.APPLICATION.USE_HARDWARE_ACCELERATION_CONFIRMATION_LABEL'),
message: this._translateService.instant(evt.checked
? 'PAGES.OPTIONS.APPLICATION.USE_HARDWARE_ACCELERATION_ENABLE_CONFIRMATION_DESCRIPTION'
: 'PAGES.OPTIONS.APPLICATION.USE_HARDWARE_ACCELERATION_DISABLE_CONFIRMATION_DESCRIPTION'
),
},
});
const dialogRef = this._dialog.open(ConfirmDialogComponent, {
data: {
title: this._translateService.instant(
"PAGES.OPTIONS.APPLICATION.USE_HARDWARE_ACCELERATION_CONFIRMATION_LABEL"
),
message: this._translateService.instant(
evt.checked
? "PAGES.OPTIONS.APPLICATION.USE_HARDWARE_ACCELERATION_ENABLE_CONFIRMATION_DESCRIPTION"
: "PAGES.OPTIONS.APPLICATION.USE_HARDWARE_ACCELERATION_DISABLE_CONFIRMATION_DESCRIPTION"
),
},
});
dialogRef.afterClosed().subscribe((result) => {
if (!result) {
evt.source.checked = !evt.source.checked;
dialogRef.afterClosed().subscribe((result) => {
if (!result) {
evt.source.checked = !evt.source.checked;
return;
}
return;
}
this.wowupService.useHardwareAcceleration = evt.checked;
this._electronService.restartApplication();
});
this.wowupService.useHardwareAcceleration = evt.checked;
this._electronService.restartApplication();
});
};
onWowUpChannelChange(evt: MatSelectChange) {

View File

@@ -12,12 +12,9 @@ import {
import { ElectronService } from "../electron/electron.service";
import * as fs from "fs";
import * as globrex from "globrex";
import { ListFilesResponse } from "common/models/list-files-response";
import { ListFilesRequest } from "common/models/list-files-request";
import { v4 as uuidv4 } from "uuid";
import { CopyFileRequest } from "common/models/copy-file-request";
import { UnzipRequest } from "common/models/unzip-request";
import { UnzipStatus } from "common/models/unzip-status";
@Injectable({
providedIn: "root",

View File

@@ -20,14 +20,14 @@ import { DownloadSevice } from "../download/download.service";
import { PreferenceChange } from "app/models/wowup/preference-change";
import { FileService } from "../files/file.service";
import {
collapseToTrayKey,
defaultAutoUpdateKeySuffix,
defaultChannelKeySuffix,
COLLAPSE_TO_TRAY_PREFERENCE_KEY,
DEFAULT_AUTO_UPDATE_PREFERENCE_KEY_SUFFIX,
DEFAULT_CHANNEL_PREFERENCE_KEY_SUFFIX,
ENABLE_SYSTEM_NOTIFICATIONS_PREFERENCE_KEY,
lastSelectedWowClientTypeKey,
wowupReleaseChannelKey,
useHardwareAccelerationKey,
} from "../../../constants";
LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY,
WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY,
USE_HARDWARE_ACCELERATION_PREFERENCE_KEY,
} from "common/constants";
const LATEST_VERSION_CACHE_KEY = "latest-version-response";
@@ -79,44 +79,44 @@ export class WowUpService {
public get collapseToTray() {
const preference = this._preferenceStorageService.findByKey(
collapseToTrayKey
COLLAPSE_TO_TRAY_PREFERENCE_KEY
);
return preference === "true";
}
public set collapseToTray(value: boolean) {
const key = collapseToTrayKey;
const key = COLLAPSE_TO_TRAY_PREFERENCE_KEY;
this._preferenceStorageService.set(key, value);
this._preferenceChangeSrc.next({ key, value: value.toString() });
}
public get useHardwareAcceleration() {
const preference = this._preferenceStorageService.findByKey(
useHardwareAccelerationKey
USE_HARDWARE_ACCELERATION_PREFERENCE_KEY
);
return preference === "true";
}
public set useHardwareAcceleration(value: boolean) {
const key = useHardwareAccelerationKey;
const key = USE_HARDWARE_ACCELERATION_PREFERENCE_KEY;
this._preferenceStorageService.set(key, value);
this._preferenceChangeSrc.next({ key, value: value.toString() });
}
public get wowUpReleaseChannel() {
const preference = this._preferenceStorageService.findByKey(
wowupReleaseChannelKey
WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY
);
return parseInt(preference, 10) as WowUpReleaseChannelType;
}
public set wowUpReleaseChannel(releaseChannel: WowUpReleaseChannelType) {
this._preferenceStorageService.set(wowupReleaseChannelKey, releaseChannel);
this._preferenceStorageService.set(WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY, releaseChannel);
}
public get lastSelectedClientType(): WowClientType {
const preference = this._preferenceStorageService.findByKey(
lastSelectedWowClientTypeKey
LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY
);
const value = parseInt(preference, 10);
return isNaN(value) ? WowClientType.None : (value as WowClientType);
@@ -124,7 +124,7 @@ export class WowUpService {
public set lastSelectedClientType(clientType: WowClientType) {
this._preferenceStorageService.set(
lastSelectedWowClientTypeKey,
LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY,
clientType
);
}
@@ -146,7 +146,7 @@ export class WowUpService {
public getClientDefaultAddonChannelKey(clientType: WowClientType) {
const typeName = getEnumName(WowClientType, clientType);
return `${typeName}${defaultChannelKeySuffix}`.toLowerCase();
return `${typeName}${DEFAULT_CHANNEL_PREFERENCE_KEY_SUFFIX}`.toLowerCase();
}
public getDefaultAddonChannel(clientType: WowClientType): AddonChannelType {
@@ -250,15 +250,15 @@ export class WowUpService {
private getClientDefaultAutoUpdateKey(clientType: WowClientType): string {
const typeName = getEnumName(WowClientType, clientType);
return `${typeName}${defaultAutoUpdateKeySuffix}`.toLowerCase();
return `${typeName}${DEFAULT_AUTO_UPDATE_PREFERENCE_KEY_SUFFIX}`.toLowerCase();
}
private setDefaultPreferences() {
this.setDefaultPreference(ENABLE_SYSTEM_NOTIFICATIONS_PREFERENCE_KEY, true);
this.setDefaultPreference(collapseToTrayKey, true);
this.setDefaultPreference(useHardwareAccelerationKey, true);
this.setDefaultPreference(COLLAPSE_TO_TRAY_PREFERENCE_KEY, true);
this.setDefaultPreference(USE_HARDWARE_ACCELERATION_PREFERENCE_KEY, true);
this.setDefaultPreference(
wowupReleaseChannelKey,
WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY,
this.getDefaultReleaseChannel()
);
this.setDefaultClientPreferences();

View File

@@ -1,7 +1,7 @@
{
"ChangeLogs": [
{
"Version": "2.0.0-alpha.12",
"Version": "2.0.0-alpha.13",
"Description": "UI Updates to details popup (Flippey).\nLocale updates. (Oleksandr, McBurn, Morten)\nAdd a hardware acceleration toggle (Linaori).\nAdd 'Released At' column to 'My Addons' page. (Chops)\nAdd some basic Linux support.\nAdd a standardized format for game version.\nAdd a toggle to turn off system notifications after an auto update.\nAdd a single instance lock so you can only launch the app once.\nFix an issue with game version column appearing blank.\nFix an issue where update all did not visual update.\nFix an issue where 'Up to Date' appeared as a greyed out button.\nFix an issue with downloaded files/folders not being cleaned up.\nFix issues with file operations erroring when perfoming multiple downloads."
},
{

View File

@@ -13,3 +13,14 @@ export const SHOW_DIRECTORY = "show-directory";
export const CURSE_GET_SCAN_RESULTS = "curse-get-scan-results";
export const WOWUP_GET_SCAN_RESULTS = "wowup-get-scan-results";
export const GET_ASSET_FILE_PATH = "get-asset-file-path";
export const ENABLE_SYSTEM_NOTIFICATIONS_PREFERENCE_KEY =
"enable_system_notifications";
export const COLLAPSE_TO_TRAY_PREFERENCE_KEY = "collapse_to_tray";
export const WOWUP_RELEASE_CHANNEL_PREFERENCE_KEY = "wowup_release_channel";
export const DEFAULT_CHANNEL_PREFERENCE_KEY_SUFFIX = "_default_addon_channel";
export const DEFAULT_AUTO_UPDATE_PREFERENCE_KEY_SUFFIX = "_default_auto_update";
export const LAST_SELECTED_WOW_CLIENT_TYPE_PREFERENCE_KEY =
"last_selected_client_type";
export const USE_HARDWARE_ACCELERATION_PREFERENCE_KEY =
"use_hardware_acceleration";

View File

@@ -1,8 +0,0 @@
export const ENABLE_SYSTEM_NOTIFICATIONS_PREFERENCE_KEY =
"enable_system_notifications";
export const collapseToTrayKey = "collapse_to_tray";
export const wowupReleaseChannelKey = "wowup_release_channel";
export const defaultChannelKeySuffix = "_default_addon_channel";
export const defaultAutoUpdateKeySuffix = "_default_auto_update";
export const lastSelectedWowClientTypeKey = "last_selected_client_type";
export const useHardwareAccelerationKey = "use_hardware_acceleration";