show toast util
This commit is contained in:
parent
79f8370f7c
commit
e0d5a4d8b7
|
@ -19,6 +19,7 @@ export abstract class PlatformUtilsService {
|
||||||
getApplicationVersion: () => string;
|
getApplicationVersion: () => string;
|
||||||
supportsU2f: (win: Window) => boolean;
|
supportsU2f: (win: Window) => boolean;
|
||||||
supportsDuo: () => boolean;
|
supportsDuo: () => boolean;
|
||||||
|
showToast: (type: 'error' | 'success' | 'warning' | 'info', title: string, text: string) => void;
|
||||||
showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string,
|
showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string,
|
||||||
type?: string) => Promise<boolean>;
|
type?: string) => Promise<boolean>;
|
||||||
isDev: () => boolean;
|
isDev: () => boolean;
|
||||||
|
|
|
@ -127,6 +127,16 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
|
||||||
return true;
|
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):
|
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];
|
||||||
|
|
Loading…
Reference in New Issue