From 641046490b4353c80e87abca5125b8cc2f9b0e15 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 26 Jan 2018 16:13:58 -0500 Subject: [PATCH] remove alerterror --- src/app/vault/view.component.ts | 9 +++++---- src/main.ts | 4 ---- src/services/desktopPlatformUtils.service.ts | 7 ------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/app/vault/view.component.ts b/src/app/vault/view.component.ts index f453b5376e..8fb65a25bf 100644 --- a/src/app/vault/view.component.ts +++ b/src/app/vault/view.component.ts @@ -10,6 +10,7 @@ import { } from '@angular/core'; import { Angulartics2 } from 'angulartics2'; +import { ToasterService } from 'angular2-toaster'; import { CipherType } from 'jslib/enums/cipherType'; import { FieldType } from 'jslib/enums/fieldType'; @@ -48,7 +49,7 @@ export class ViewComponent implements OnChanges, OnDestroy { constructor(private cipherService: CipherService, private totpService: TotpService, private tokenService: TokenService, private utilsService: UtilsService, private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService, - private i18nService: I18nService, private analytics: Angulartics2) { + private i18nService: I18nService, private analytics: Angulartics2, private toasterService: ToasterService) { } async ngOnChanges() { @@ -113,7 +114,7 @@ export class ViewComponent implements OnChanges, OnDestroy { } if (this.cipher.organizationId == null && !this.isPremium) { - this.platformUtilsService.alertError(this.i18nService.t('premiumRequired'), + this.toasterService.popAsync('error', this.i18nService.t('premiumRequired'), this.i18nService.t('premiumRequiredDesc')); return; } @@ -121,7 +122,7 @@ export class ViewComponent implements OnChanges, OnDestroy { a.downloading = true; const response = await fetch(new Request(attachment.url, { cache: 'no-cache' })); if (response.status !== 200) { - this.platformUtilsService.alertError(null, this.i18nService.t('errorOccurred')); + this.toasterService.popAsync('error', null, this.i18nService.t('errorOccurred')); a.downloading = false; return; } @@ -132,7 +133,7 @@ export class ViewComponent implements OnChanges, OnDestroy { const decBuf = await this.cryptoService.decryptFromBytes(buf, key); this.platformUtilsService.saveFile(window, decBuf, null, attachment.fileName); } catch (e) { - this.platformUtilsService.alertError(null, this.i18nService.t('errorOccurred')); + this.toasterService.popAsync('error', null, this.i18nService.t('errorOccurred')); } a.downloading = false; diff --git a/src/main.ts b/src/main.ts index 23226659dc..5df545547a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -26,10 +26,6 @@ ipcMain.on('keytar', async (event: any, message: any) => { }); */ -ipcMain.on('showError', async (event: any, message: any) => { - dialog.showErrorBox(message.title, message.message); -}); - import { I18nService } from './services/i18n.service'; const i18nService = new I18nService('en', './locales/'); i18nService.init().then(() => { }); diff --git a/src/services/desktopPlatformUtils.service.ts b/src/services/desktopPlatformUtils.service.ts index 63fa9c90f2..494895300d 100644 --- a/src/services/desktopPlatformUtils.service.ts +++ b/src/services/desktopPlatformUtils.service.ts @@ -114,13 +114,6 @@ export class DesktopPlatformUtilsService implements PlatformUtilsService { window.document.body.removeChild(a); } - alertError(title: string, message: string): void { - ipcRenderer.send('showError', { - title: title || this.i18nService.t('error'), - message: message, - }); - } - getApplicationVersion(): string { return (window as any).require('electron').remote.app.getVersion(); }