updates to support electron 6

This commit is contained in:
Kyle Spearrin 2020-01-27 09:46:42 -05:00
parent 47617c6160
commit e1d42f95d9
3 changed files with 25 additions and 22 deletions

View File

@ -48,7 +48,7 @@ export class BaseMenu {
{ type: 'separator' },
{
label: this.i18nService.t('selectAll'),
role: 'selectall',
role: 'selectAll',
},
],
};
@ -56,15 +56,18 @@ export class BaseMenu {
this.viewSubMenuItemOptions = [
{
label: this.i18nService.t('zoomIn'),
role: 'zoomin', accelerator: 'CmdOrCtrl+=',
role: 'zoomIn',
accelerator: 'CmdOrCtrl+=',
},
{
label: this.i18nService.t('zoomOut'),
role: 'zoomout', accelerator: 'CmdOrCtrl+-',
role: 'zoomOut',
accelerator: 'CmdOrCtrl+-',
},
{
label: this.i18nService.t('resetZoom'),
role: 'resetzoom', accelerator: 'CmdOrCtrl+0',
role: 'resetZoom',
accelerator: 'CmdOrCtrl+0',
},
{ type: 'separator' },
{
@ -74,11 +77,11 @@ export class BaseMenu {
{ type: 'separator' },
{
label: this.i18nService.t('reload'),
role: 'forcereload',
role: 'forceReload',
},
{
label: this.i18nService.t('toggleDevTools'),
role: 'toggledevtools',
role: 'toggleDevTools',
accelerator: 'F12',
},
];
@ -111,7 +114,7 @@ export class BaseMenu {
},
{
label: this.i18nService.t('hideOthers'),
role: 'hideothers',
role: 'hideOthers',
},
{
label: this.i18nService.t('showAll'),
@ -159,7 +162,7 @@ export class BaseMenu {
{ type: 'separator' },
{
label: this.i18nService.t('selectAll'),
role: 'selectall',
role: 'selectAll',
},
]);
@ -190,7 +193,7 @@ export class BaseMenu {
{ type: 'separator' },
{
label: this.i18nService.t('selectAll'),
role: 'selectall',
role: 'selectAll',
},
]);
@ -210,7 +213,7 @@ export class BaseMenu {
{ type: 'separator' },
{
label: this.i18nService.t('selectAll'),
role: 'selectall',
role: 'selectAll',
},
]);

View File

@ -114,9 +114,9 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
remote.dialog.showSaveDialog(remote.getCurrentWindow(), {
defaultPath: fileName,
showsTagField: false,
}, (path) => {
if (path != null) {
fs.writeFile(path, Buffer.from(blobData), (err) => {
}).then((ret) => {
if (ret.filePath != null) {
fs.writeFile(ret.filePath, Buffer.from(blobData), (err) => {
// error check?
});
}
@ -147,14 +147,14 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
});
}
showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):
async showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):
Promise<boolean> {
const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText];
if (cancelText != null) {
buttons.push(cancelText);
}
const result = remote.dialog.showMessageBox(remote.getCurrentWindow(), {
const result = await remote.dialog.showMessageBox(remote.getCurrentWindow(), {
type: type,
title: title,
message: title,
@ -165,7 +165,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
noLink: true,
});
return Promise.resolve(result === 0);
return Promise.resolve(result.response === 0);
}
eventTrack(action: string, label?: string, options?: any) {

View File

@ -50,14 +50,14 @@ export class UpdaterMain {
this.doingUpdateCheck = true;
});
autoUpdater.on('update-available', () => {
autoUpdater.on('update-available', async () => {
if (this.doingUpdateCheckWithFeedback) {
if (this.windowMain.win == null) {
this.reset();
return;
}
const result = dialog.showMessageBox(this.windowMain.win, {
const result = await dialog.showMessageBox(this.windowMain.win, {
type: 'info',
title: this.i18nService.t(this.projectName) + ' - ' + this.i18nService.t('updateAvailable'),
message: this.i18nService.t('updateAvailable'),
@ -68,7 +68,7 @@ export class UpdaterMain {
noLink: true,
});
if (result === 0) {
if (result.response === 0) {
autoUpdater.downloadUpdate();
} else {
this.reset();
@ -89,7 +89,7 @@ export class UpdaterMain {
this.reset();
});
autoUpdater.on('update-downloaded', (info) => {
autoUpdater.on('update-downloaded', async (info) => {
if (this.onUpdateDownloaded != null) {
this.onUpdateDownloaded();
}
@ -98,7 +98,7 @@ export class UpdaterMain {
return;
}
const result = dialog.showMessageBox(this.windowMain.win, {
const result = await dialog.showMessageBox(this.windowMain.win, {
type: 'info',
title: this.i18nService.t(this.projectName) + ' - ' + this.i18nService.t('restartToUpdate'),
message: this.i18nService.t('restartToUpdate'),
@ -109,7 +109,7 @@ export class UpdaterMain {
noLink: true,
});
if (result === 0) {
if (result.response === 0) {
autoUpdater.quitAndInstall(false, true);
}
});