1
0
mirror of https://github.com/bitwarden/web synced 2026-01-01 08:03:13 +00:00

convert analytics and toaster to platform utils

This commit is contained in:
Kyle Spearrin
2018-10-03 10:33:04 -04:00
parent d4dd962193
commit 68ed8e51bd
21 changed files with 99 additions and 115 deletions

View File

@@ -1,6 +1,3 @@
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { Component } from '@angular/core';
import { CryptoService } from 'jslib/abstractions/crypto.service';
@@ -15,16 +12,14 @@ import { ExportComponent as BaseExportComponent } from 'jslib/angular/components
templateUrl: 'export.component.html',
})
export class ExportComponent extends BaseExportComponent {
constructor(analytics: Angulartics2, toasterService: ToasterService,
cryptoService: CryptoService, i18nService: I18nService,
constructor(cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService) {
super(analytics, toasterService, cryptoService, i18nService, platformUtilsService,
exportService, window);
super(cryptoService, i18nService, platformUtilsService, exportService, window);
}
protected saved() {
super.saved();
this.masterPassword = null;
this.toasterService.popAsync('success', null, this.i18nService.t('exportSuccess'));
this.platformUtilsService.showToast('success', null, this.i18nService.t('exportSuccess'));
}
}

View File

@@ -129,7 +129,7 @@ export class ImportComponent implements OnInit {
reader.onload = (evt) => {
if (this.format === 'lastpasscsv' && file.type === 'text/html') {
const parser = new DOMParser();
const doc = parser.parseFromString(evt.target.result, 'text/html');
const doc = parser.parseFromString((evt.target as any).result, 'text/html');
const pre = doc.querySelector('pre');
if (pre != null) {
resolve(pre.textContent);
@@ -139,7 +139,7 @@ export class ImportComponent implements OnInit {
return;
}
resolve(evt.target.result);
resolve((evt.target as any).result);
};
reader.onerror = () => {
reject();

View File

@@ -1,6 +1,3 @@
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { Component } from '@angular/core';
import { I18nService } from 'jslib/abstractions/i18n.service';
@@ -16,9 +13,8 @@ import {
templateUrl: 'password-generator-history.component.html',
})
export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHistoryComponent {
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
toasterService: ToasterService) {
super(passwordGenerationService, analytics, platformUtilsService, i18nService, toasterService, window);
constructor(passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService) {
super(passwordGenerationService, platformUtilsService, i18nService, window);
}
}

View File

@@ -1,6 +1,3 @@
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import {
Component,
ComponentFactoryResolver,
@@ -28,10 +25,9 @@ export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
private modal: ModalComponent = null;
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
toasterService: ToasterService, private componentFactoryResolver: ComponentFactoryResolver) {
super(passwordGenerationService, analytics, platformUtilsService, i18nService, toasterService, window);
constructor(passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, private componentFactoryResolver: ComponentFactoryResolver) {
super(passwordGenerationService, platformUtilsService, i18nService, window);
}
history() {