1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 02:33:46 +00:00

Replace toaster library (#2210)

This commit is contained in:
Oscar Hinton
2021-12-07 19:42:18 +00:00
committed by GitHub
parent 86b4340bfb
commit e4aaf81816
10 changed files with 91 additions and 112 deletions

View File

@@ -6,7 +6,6 @@ import {
} from '@angular/core';
import { FormControl } from '@angular/forms';
import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import Swal from 'sweetalert2/src/sweetalert2.js';
import { BrowserApi } from '../../browser/browserApi';
@@ -68,7 +67,7 @@ export class SettingsComponent implements OnInit {
public messagingService: MessagingService, private router: Router,
private environmentService: EnvironmentService, private cryptoService: CryptoService,
private userService: UserService, private popupUtilsService: PopupUtilsService,
private modalService: ModalService, private toasterService: ToasterService,
private modalService: ModalService,
private keyConnectorService: KeyConnectorService) {
}
@@ -136,7 +135,7 @@ export class SettingsComponent implements OnInit {
}
if (!this.vaultTimeout.valid) {
this.toasterService.popAsync('error', null, this.i18nService.t('vaultTimeoutToLarge'));
this.platformUtilsService.showToast('error', null, this.i18nService.t('vaultTimeoutToLarge'));
return;
}
@@ -165,7 +164,7 @@ export class SettingsComponent implements OnInit {
}
if (!this.vaultTimeout.valid) {
this.toasterService.popAsync('error', null, this.i18nService.t('vaultTimeoutToLarge'));
this.platformUtilsService.showToast('error', null, this.i18nService.t('vaultTimeoutToLarge'));
return;
}

View File

@@ -1,11 +1,10 @@
import { ToasterService } from 'angular2-toaster';
import {
Component,
OnInit,
} from '@angular/core';
import { I18nService } from 'jslib-common/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
import { SyncService } from 'jslib-common/abstractions/sync.service';
@Component({
@@ -16,7 +15,7 @@ export class SyncComponent implements OnInit {
lastSync = '--';
syncPromise: Promise<any>;
constructor(private syncService: SyncService, private toasterService: ToasterService,
constructor(private syncService: SyncService, private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService) {
}
@@ -29,9 +28,9 @@ export class SyncComponent implements OnInit {
const success = await this.syncPromise;
if (success) {
await this.setLastSync();
this.toasterService.popAsync('success', null, this.i18nService.t('syncingComplete'));
this.platformUtilsService.showToast('success', null, this.i18nService.t('syncingComplete'));
} else {
this.toasterService.popAsync('error', null, this.i18nService.t('syncingFailed'));
this.platformUtilsService.showToast('error', null, this.i18nService.t('syncingFailed'));
}
}