mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-27 12:36:14 +01:00
show toast util
This commit is contained in:
parent
79f8370f7c
commit
e0d5a4d8b7
@ -19,6 +19,7 @@ export abstract class PlatformUtilsService {
|
||||
getApplicationVersion: () => string;
|
||||
supportsU2f: (win: Window) => boolean;
|
||||
supportsDuo: () => boolean;
|
||||
showToast: (type: 'error' | 'success' | 'warning' | 'info', title: string, text: string) => void;
|
||||
showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string,
|
||||
type?: string) => Promise<boolean>;
|
||||
isDev: () => boolean;
|
||||
|
@ -127,6 +127,16 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||
return true;
|
||||
}
|
||||
|
||||
showToast(type: 'error' | 'success' | 'warning' | 'info', title: string, text: string, global?: any): void {
|
||||
if (global == null && Utils.isBrowser) {
|
||||
global = window;
|
||||
}
|
||||
if (global == null || global.BitwardenToasterService == null) {
|
||||
throw new Error('BitwardenToasterService not available on global.');
|
||||
}
|
||||
global.BitwardenToasterService.popAsync(type, title, text);
|
||||
}
|
||||
|
||||
showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):
|
||||
Promise<boolean> {
|
||||
const buttons = [confirmText == null ? this.i18nService.t('ok') : confirmText];
|
||||
|
Loading…
Reference in New Issue
Block a user