updates to support electron 6
This commit is contained in:
parent
47617c6160
commit
e1d42f95d9
|
@ -48,7 +48,7 @@ export class BaseMenu {
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('selectAll'),
|
label: this.i18nService.t('selectAll'),
|
||||||
role: 'selectall',
|
role: 'selectAll',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -56,15 +56,18 @@ export class BaseMenu {
|
||||||
this.viewSubMenuItemOptions = [
|
this.viewSubMenuItemOptions = [
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('zoomIn'),
|
label: this.i18nService.t('zoomIn'),
|
||||||
role: 'zoomin', accelerator: 'CmdOrCtrl+=',
|
role: 'zoomIn',
|
||||||
|
accelerator: 'CmdOrCtrl+=',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('zoomOut'),
|
label: this.i18nService.t('zoomOut'),
|
||||||
role: 'zoomout', accelerator: 'CmdOrCtrl+-',
|
role: 'zoomOut',
|
||||||
|
accelerator: 'CmdOrCtrl+-',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('resetZoom'),
|
label: this.i18nService.t('resetZoom'),
|
||||||
role: 'resetzoom', accelerator: 'CmdOrCtrl+0',
|
role: 'resetZoom',
|
||||||
|
accelerator: 'CmdOrCtrl+0',
|
||||||
},
|
},
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
|
@ -74,11 +77,11 @@ export class BaseMenu {
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('reload'),
|
label: this.i18nService.t('reload'),
|
||||||
role: 'forcereload',
|
role: 'forceReload',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('toggleDevTools'),
|
label: this.i18nService.t('toggleDevTools'),
|
||||||
role: 'toggledevtools',
|
role: 'toggleDevTools',
|
||||||
accelerator: 'F12',
|
accelerator: 'F12',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -111,7 +114,7 @@ export class BaseMenu {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('hideOthers'),
|
label: this.i18nService.t('hideOthers'),
|
||||||
role: 'hideothers',
|
role: 'hideOthers',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('showAll'),
|
label: this.i18nService.t('showAll'),
|
||||||
|
@ -159,7 +162,7 @@ export class BaseMenu {
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('selectAll'),
|
label: this.i18nService.t('selectAll'),
|
||||||
role: 'selectall',
|
role: 'selectAll',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -190,7 +193,7 @@ export class BaseMenu {
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('selectAll'),
|
label: this.i18nService.t('selectAll'),
|
||||||
role: 'selectall',
|
role: 'selectAll',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -210,7 +213,7 @@ export class BaseMenu {
|
||||||
{ type: 'separator' },
|
{ type: 'separator' },
|
||||||
{
|
{
|
||||||
label: this.i18nService.t('selectAll'),
|
label: this.i18nService.t('selectAll'),
|
||||||
role: 'selectall',
|
role: 'selectAll',
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -114,9 +114,9 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||||
remote.dialog.showSaveDialog(remote.getCurrentWindow(), {
|
remote.dialog.showSaveDialog(remote.getCurrentWindow(), {
|
||||||
defaultPath: fileName,
|
defaultPath: fileName,
|
||||||
showsTagField: false,
|
showsTagField: false,
|
||||||
}, (path) => {
|
}).then((ret) => {
|
||||||
if (path != null) {
|
if (ret.filePath != null) {
|
||||||
fs.writeFile(path, Buffer.from(blobData), (err) => {
|
fs.writeFile(ret.filePath, Buffer.from(blobData), (err) => {
|
||||||
// error check?
|
// 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> {
|
Promise<boolean> {
|
||||||
const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText];
|
const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText];
|
||||||
if (cancelText != null) {
|
if (cancelText != null) {
|
||||||
buttons.push(cancelText);
|
buttons.push(cancelText);
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = remote.dialog.showMessageBox(remote.getCurrentWindow(), {
|
const result = await remote.dialog.showMessageBox(remote.getCurrentWindow(), {
|
||||||
type: type,
|
type: type,
|
||||||
title: title,
|
title: title,
|
||||||
message: title,
|
message: title,
|
||||||
|
@ -165,7 +165,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||||
noLink: true,
|
noLink: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return Promise.resolve(result === 0);
|
return Promise.resolve(result.response === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
eventTrack(action: string, label?: string, options?: any) {
|
eventTrack(action: string, label?: string, options?: any) {
|
||||||
|
|
|
@ -50,14 +50,14 @@ export class UpdaterMain {
|
||||||
this.doingUpdateCheck = true;
|
this.doingUpdateCheck = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', async () => {
|
||||||
if (this.doingUpdateCheckWithFeedback) {
|
if (this.doingUpdateCheckWithFeedback) {
|
||||||
if (this.windowMain.win == null) {
|
if (this.windowMain.win == null) {
|
||||||
this.reset();
|
this.reset();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = dialog.showMessageBox(this.windowMain.win, {
|
const result = await dialog.showMessageBox(this.windowMain.win, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: this.i18nService.t(this.projectName) + ' - ' + this.i18nService.t('updateAvailable'),
|
title: this.i18nService.t(this.projectName) + ' - ' + this.i18nService.t('updateAvailable'),
|
||||||
message: this.i18nService.t('updateAvailable'),
|
message: this.i18nService.t('updateAvailable'),
|
||||||
|
@ -68,7 +68,7 @@ export class UpdaterMain {
|
||||||
noLink: true,
|
noLink: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result === 0) {
|
if (result.response === 0) {
|
||||||
autoUpdater.downloadUpdate();
|
autoUpdater.downloadUpdate();
|
||||||
} else {
|
} else {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
@ -89,7 +89,7 @@ export class UpdaterMain {
|
||||||
this.reset();
|
this.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', (info) => {
|
autoUpdater.on('update-downloaded', async (info) => {
|
||||||
if (this.onUpdateDownloaded != null) {
|
if (this.onUpdateDownloaded != null) {
|
||||||
this.onUpdateDownloaded();
|
this.onUpdateDownloaded();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ export class UpdaterMain {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = dialog.showMessageBox(this.windowMain.win, {
|
const result = await dialog.showMessageBox(this.windowMain.win, {
|
||||||
type: 'info',
|
type: 'info',
|
||||||
title: this.i18nService.t(this.projectName) + ' - ' + this.i18nService.t('restartToUpdate'),
|
title: this.i18nService.t(this.projectName) + ' - ' + this.i18nService.t('restartToUpdate'),
|
||||||
message: this.i18nService.t('restartToUpdate'),
|
message: this.i18nService.t('restartToUpdate'),
|
||||||
|
@ -109,7 +109,7 @@ export class UpdaterMain {
|
||||||
noLink: true,
|
noLink: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (result === 0) {
|
if (result.response === 0) {
|
||||||
autoUpdater.quitAndInstall(false, true);
|
autoUpdater.quitAndInstall(false, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue