mirror of
https://github.com/bitwarden/browser
synced 2026-01-07 19:13:39 +00:00
show dialog device util
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ipcRenderer, shell } from 'electron';
|
||||
import { remote, shell } from 'electron';
|
||||
|
||||
import { DeviceType } from 'jslib/enums';
|
||||
|
||||
@@ -123,4 +123,24 @@ export class DesktopPlatformUtilsService implements PlatformUtilsService {
|
||||
// ref: https://github.com/electron/electron/issues/3226
|
||||
return false;
|
||||
}
|
||||
|
||||
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(), {
|
||||
type: type,
|
||||
title: title,
|
||||
message: text,
|
||||
buttons: buttons,
|
||||
cancelId: buttons.length === 2 ? 1 : null,
|
||||
defaultId: 0,
|
||||
noLink: true,
|
||||
});
|
||||
|
||||
return Promise.resolve(result === 0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user