mirror of
https://github.com/bitwarden/browser
synced 2024-12-26 09:54:35 +01:00
updates to support electron 6
This commit is contained in:
parent
47617c6160
commit
e1d42f95d9
@ -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',
|
||||
},
|
||||
]);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user