1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-07 09:31:31 +01:00

remove alerterror

This commit is contained in:
Kyle Spearrin 2018-01-26 16:13:58 -05:00
parent a8e98f66bd
commit 641046490b
3 changed files with 5 additions and 15 deletions

View File

@ -10,6 +10,7 @@ import {
} from '@angular/core'; } from '@angular/core';
import { Angulartics2 } from 'angulartics2'; import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster';
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
import { FieldType } from 'jslib/enums/fieldType'; import { FieldType } from 'jslib/enums/fieldType';
@ -48,7 +49,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
constructor(private cipherService: CipherService, private totpService: TotpService, constructor(private cipherService: CipherService, private totpService: TotpService,
private tokenService: TokenService, private utilsService: UtilsService, private tokenService: TokenService, private utilsService: UtilsService,
private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService, private cryptoService: CryptoService, private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService, private analytics: Angulartics2) { private i18nService: I18nService, private analytics: Angulartics2, private toasterService: ToasterService) {
} }
async ngOnChanges() { async ngOnChanges() {
@ -113,7 +114,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
} }
if (this.cipher.organizationId == null && !this.isPremium) { 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')); this.i18nService.t('premiumRequiredDesc'));
return; return;
} }
@ -121,7 +122,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
a.downloading = true; a.downloading = true;
const response = await fetch(new Request(attachment.url, { cache: 'no-cache' })); const response = await fetch(new Request(attachment.url, { cache: 'no-cache' }));
if (response.status !== 200) { if (response.status !== 200) {
this.platformUtilsService.alertError(null, this.i18nService.t('errorOccurred')); this.toasterService.popAsync('error', null, this.i18nService.t('errorOccurred'));
a.downloading = false; a.downloading = false;
return; return;
} }
@ -132,7 +133,7 @@ export class ViewComponent implements OnChanges, OnDestroy {
const decBuf = await this.cryptoService.decryptFromBytes(buf, key); const decBuf = await this.cryptoService.decryptFromBytes(buf, key);
this.platformUtilsService.saveFile(window, decBuf, null, attachment.fileName); this.platformUtilsService.saveFile(window, decBuf, null, attachment.fileName);
} catch (e) { } catch (e) {
this.platformUtilsService.alertError(null, this.i18nService.t('errorOccurred')); this.toasterService.popAsync('error', null, this.i18nService.t('errorOccurred'));
} }
a.downloading = false; a.downloading = false;

View File

@ -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'; import { I18nService } from './services/i18n.service';
const i18nService = new I18nService('en', './locales/'); const i18nService = new I18nService('en', './locales/');
i18nService.init().then(() => { }); i18nService.init().then(() => { });

View File

@ -114,13 +114,6 @@ export class DesktopPlatformUtilsService implements PlatformUtilsService {
window.document.body.removeChild(a); window.document.body.removeChild(a);
} }
alertError(title: string, message: string): void {
ipcRenderer.send('showError', {
title: title || this.i18nService.t('error'),
message: message,
});
}
getApplicationVersion(): string { getApplicationVersion(): string {
return (window as any).require('electron').remote.app.getVersion(); return (window as any).require('electron').remote.app.getVersion();
} }