1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 00:33:44 +00:00

refactor toaster to platform showToast

This commit is contained in:
Kyle Spearrin
2018-10-02 23:09:19 -04:00
parent 45341ec408
commit f793ff0aa5
21 changed files with 85 additions and 117 deletions

View File

@@ -140,14 +140,15 @@ 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;
showToast(type: 'error' | 'success' | 'warning' | 'info', title: string, text: string | string[],
options?: any): void {
if ((options == null || options.global == null) && Utils.isBrowser) {
options.global = window;
}
if (global == null || global.BitwardenToasterService == null) {
if (options.global == null || options.global.BitwardenToasterService == null) {
throw new Error('BitwardenToasterService not available on global.');
}
global.BitwardenToasterService.popAsync(type, title, text);
options.global.BitwardenToasterService.popAsync(type, title, text);
}
showDialog(text: string, title?: string, confirmText?: string, cancelText?: string, type?: string):