1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-30 13:03:53 +01:00

move toaster and analytics to platform utils

This commit is contained in:
Kyle Spearrin 2018-10-03 09:42:11 -04:00
parent 6858ee8624
commit 2ca8ac573b
20 changed files with 91 additions and 118 deletions

2
jslib

@ -1 +1 @@
Subproject commit 45341ec408319cbf69a4772e503a3991ae770a49 Subproject commit 6b3dc2344f2db167cbc404d83fa4602a1ca93ef8

View File

@ -1,10 +1,8 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { EnvironmentComponent as BaseEnvironmentComponent } from 'jslib/angular/components/environment.component'; import { EnvironmentComponent as BaseEnvironmentComponent } from 'jslib/angular/components/environment.component';
@ -13,8 +11,8 @@ import { EnvironmentComponent as BaseEnvironmentComponent } from 'jslib/angular/
templateUrl: 'environment.component.html', templateUrl: 'environment.component.html',
}) })
export class EnvironmentComponent extends BaseEnvironmentComponent { export class EnvironmentComponent extends BaseEnvironmentComponent {
constructor(analytics: Angulartics2, toasterService: ToasterService, constructor(platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
environmentService: EnvironmentService, i18nService: I18nService) { i18nService: I18nService) {
super(analytics, toasterService, environmentService, i18nService); super(platformUtilsService, environmentService, i18nService);
} }
} }

View File

@ -1,11 +1,9 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service'; import { ApiService } from 'jslib/abstractions/api.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { HintComponent as BaseHintComponent } from 'jslib/angular/components/hint.component'; import { HintComponent as BaseHintComponent } from 'jslib/angular/components/hint.component';
@ -14,9 +12,8 @@ import { HintComponent as BaseHintComponent } from 'jslib/angular/components/hin
templateUrl: 'hint.component.html', templateUrl: 'hint.component.html',
}) })
export class HintComponent extends BaseHintComponent { export class HintComponent extends BaseHintComponent {
constructor(router: Router, analytics: Angulartics2, constructor(router: Router, platformUtilsService: PlatformUtilsService,
toasterService: ToasterService, i18nService: I18nService, i18nService: I18nService, apiService: ApiService) {
apiService: ApiService) { super(router, i18nService, apiService, platformUtilsService);
super(router, analytics, toasterService, i18nService, apiService);
} }
} }

View File

@ -1,9 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service'; import { MessagingService } from 'jslib/abstractions/messaging.service';
@ -17,11 +14,9 @@ import { LockComponent as BaseLockComponent } from 'jslib/angular/components/loc
templateUrl: 'lock.component.html', templateUrl: 'lock.component.html',
}) })
export class LockComponent extends BaseLockComponent { export class LockComponent extends BaseLockComponent {
constructor(router: Router, analytics: Angulartics2, constructor(router: Router, i18nService: I18nService,
toasterService: ToasterService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, messagingService: MessagingService, platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
userService: UserService, cryptoService: CryptoService) { userService: UserService, cryptoService: CryptoService) {
super(router, analytics, toasterService, i18nService, platformUtilsService, super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService);
messagingService, userService, cryptoService);
} }
} }

View File

@ -6,13 +6,11 @@ import {
} from '@angular/core'; } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentComponent } from './environment.component'; import { EnvironmentComponent } from './environment.component';
import { AuthService } from 'jslib/abstractions/auth.service'; import { AuthService } from 'jslib/abstractions/auth.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { StorageService } from 'jslib/abstractions/storage.service'; import { StorageService } from 'jslib/abstractions/storage.service';
import { SyncService } from 'jslib/abstractions/sync.service'; import { SyncService } from 'jslib/abstractions/sync.service';
@ -27,10 +25,10 @@ export class LoginComponent extends BaseLoginComponent {
@ViewChild('environment', { read: ViewContainerRef }) environmentModal: ViewContainerRef; @ViewChild('environment', { read: ViewContainerRef }) environmentModal: ViewContainerRef;
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService, i18nService: I18nService, syncService: SyncService,
i18nService: I18nService, private syncService: SyncService, private componentFactoryResolver: ComponentFactoryResolver, storageService: StorageService,
private componentFactoryResolver: ComponentFactoryResolver, storageService: StorageService) { platformUtilsService: PlatformUtilsService) {
super(authService, router, analytics, toasterService, i18nService, storageService); super(authService, router, platformUtilsService, i18nService, storageService);
super.onSuccessfulLogin = () => { super.onSuccessfulLogin = () => {
return syncService.fullSync(true); return syncService.fullSync(true);
}; };

View File

@ -1,8 +1,5 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service'; import { ApiService } from 'jslib/abstractions/api.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@ -15,9 +12,8 @@ import { PremiumComponent as BasePremiumComponent } from 'jslib/angular/componen
templateUrl: 'premium.component.html', templateUrl: 'premium.component.html',
}) })
export class PremiumComponent extends BasePremiumComponent { export class PremiumComponent extends BasePremiumComponent {
constructor(analytics: Angulartics2, toasterService: ToasterService, constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
tokenService: TokenService, apiService: ApiService) { tokenService: TokenService, apiService: ApiService) {
super(analytics, toasterService, i18nService, platformUtilsService, tokenService, apiService); super(i18nService, platformUtilsService, tokenService, apiService);
} }
} }

View File

@ -1,9 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service'; import { ApiService } from 'jslib/abstractions/api.service';
import { AuthService } from 'jslib/abstractions/auth.service'; import { AuthService } from 'jslib/abstractions/auth.service';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
@ -19,11 +16,9 @@ import { RegisterComponent as BaseRegisterComponent } from 'jslib/angular/compon
}) })
export class RegisterComponent extends BaseRegisterComponent { export class RegisterComponent extends BaseRegisterComponent {
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, cryptoService: CryptoService, i18nService: I18nService, cryptoService: CryptoService,
apiService: ApiService, stateService: StateService, apiService: ApiService, stateService: StateService,
platformUtilsService: PlatformUtilsService) { platformUtilsService: PlatformUtilsService) {
super(authService, router, analytics, toasterService, i18nService, cryptoService, apiService, stateService, super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService);
platformUtilsService);
} }
} }

View File

@ -39,7 +39,7 @@ export class SettingsComponent implements OnInit {
themeOptions: any[]; themeOptions: any[];
constructor(private analytics: Angulartics2, private toasterService: ToasterService, constructor(private analytics: Angulartics2, private toasterService: ToasterService,
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
private storageService: StorageService, private lockService: LockService, private storageService: StorageService, private lockService: LockService,
private stateService: StateService, private messagingService: MessagingService) { private stateService: StateService, private messagingService: MessagingService) {
this.lockOptions = [ this.lockOptions = [

View File

@ -1,9 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { AuthService } from 'jslib/abstractions/auth.service'; import { AuthService } from 'jslib/abstractions/auth.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@ -18,8 +15,7 @@ import {
}) })
export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent { export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent {
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService) { i18nService: I18nService, platformUtilsService: PlatformUtilsService) {
super(authService, router, analytics, toasterService, i18nService, platformUtilsService, window); super(authService, router, i18nService, platformUtilsService, window);
} }
} }

View File

@ -7,9 +7,6 @@ import {
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { TwoFactorOptionsComponent } from './two-factor-options.component'; import { TwoFactorOptionsComponent } from './two-factor-options.component';
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType'; import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
@ -32,12 +29,10 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
@ViewChild('twoFactorOptions', { read: ViewContainerRef }) twoFactorOptionsModal: ViewContainerRef; @ViewChild('twoFactorOptions', { read: ViewContainerRef }) twoFactorOptionsModal: ViewContainerRef;
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService, apiService: ApiService, i18nService: I18nService, apiService: ApiService,
platformUtilsService: PlatformUtilsService, private syncService: SyncService, platformUtilsService: PlatformUtilsService, syncService: SyncService,
environmentService: EnvironmentService, private componentFactoryResolver: ComponentFactoryResolver) { environmentService: EnvironmentService, private componentFactoryResolver: ComponentFactoryResolver) {
super(authService, router, analytics, toasterService, i18nService, apiService, super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService);
platformUtilsService, window, environmentService);
super.onSuccessfulLogin = () => { super.onSuccessfulLogin = () => {
return syncService.fullSync(true); return syncService.fullSync(true);
}; };

View File

@ -1,4 +1,10 @@
import { ToasterConfig } from 'angular2-toaster'; import {
BodyOutputType,
Toast,
ToasterConfig,
ToasterContainerComponent,
ToasterService,
} from 'angular2-toaster';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { import {
@ -6,17 +12,18 @@ import {
ComponentFactoryResolver, ComponentFactoryResolver,
NgZone, NgZone,
OnInit, OnInit,
SecurityContext,
Type, Type,
ViewChild, ViewChild,
ViewContainerRef, ViewContainerRef,
} from '@angular/core'; } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { PremiumComponent } from './accounts/premium.component'; import { PremiumComponent } from './accounts/premium.component';
import { SettingsComponent } from './accounts/settings.component'; import { SettingsComponent } from './accounts/settings.component';
import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component'; import { PasswordGeneratorHistoryComponent } from './vault/password-generator-history.component';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2'; import { Angulartics2 } from 'angulartics2';
import { ModalComponent } from 'jslib/angular/components/modal.component'; import { ModalComponent } from 'jslib/angular/components/modal.component';
@ -33,7 +40,6 @@ import { LockService } from 'jslib/abstractions/lock.service';
import { MessagingService } from 'jslib/abstractions/messaging.service'; import { MessagingService } from 'jslib/abstractions/messaging.service';
import { NotificationsService } from 'jslib/abstractions/notifications.service'; import { NotificationsService } from 'jslib/abstractions/notifications.service';
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service'; import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { SearchService } from 'jslib/abstractions/search.service'; import { SearchService } from 'jslib/abstractions/search.service';
import { SettingsService } from 'jslib/abstractions/settings.service'; import { SettingsService } from 'jslib/abstractions/settings.service';
import { StorageService } from 'jslib/abstractions/storage.service'; import { StorageService } from 'jslib/abstractions/storage.service';
@ -80,13 +86,11 @@ export class AppComponent implements OnInit {
private passwordGenerationService: PasswordGenerationService, private cipherService: CipherService, private passwordGenerationService: PasswordGenerationService, private cipherService: CipherService,
private authService: AuthService, private router: Router, private analytics: Angulartics2, private authService: AuthService, private router: Router, private analytics: Angulartics2,
private toasterService: ToasterService, private i18nService: I18nService, private toasterService: ToasterService, private i18nService: I18nService,
private platformUtilsService: PlatformUtilsService, private ngZone: NgZone, private sanitizer: DomSanitizer, private ngZone: NgZone,
private lockService: LockService, private storageService: StorageService, private lockService: LockService, private storageService: StorageService,
private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver, private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver,
private messagingService: MessagingService, private collectionService: CollectionService, private messagingService: MessagingService, private collectionService: CollectionService,
private searchService: SearchService, private notificationsService: NotificationsService) { private searchService: SearchService, private notificationsService: NotificationsService) { }
(window as any).BitwardenToasterService = toasterService;
}
ngOnInit() { ngOnInit() {
this.ngZone.runOutsideAngular(() => { this.ngZone.runOutsideAngular(() => {
@ -136,6 +140,15 @@ export class AppComponent implements OnInit {
this.openModal<PasswordGeneratorHistoryComponent>( this.openModal<PasswordGeneratorHistoryComponent>(
PasswordGeneratorHistoryComponent, this.passwordHistoryRef); PasswordGeneratorHistoryComponent, this.passwordHistoryRef);
break; break;
case 'showToast':
await this.showToast(message);
break;
case 'analyticsEventTrack':
this.analytics.eventTrack.next({
action: message.action,
properties: { label: message.label },
});
break;
default: default:
} }
}); });
@ -226,4 +239,31 @@ export class AppComponent implements OnInit {
this.modal = null; this.modal = null;
}); });
} }
private async showToast(msg: any) {
const toast: Toast = {
type: msg.type,
title: msg.title,
};
if (typeof (msg.text) === 'string') {
toast.body = msg.text;
} else if (msg.text.length === 1) {
toast.body = msg.text[0];
} else {
let message = '';
msg.text.forEach((t: string) =>
message += ('<p>' + this.sanitizer.sanitize(SecurityContext.HTML, t) + '</p>'));
toast.body = message;
toast.bodyOutputType = BodyOutputType.TrustedHtml;
}
if (msg.options != null) {
if (msg.options.trustedHtml === true) {
toast.bodyOutputType = BodyOutputType.TrustedHtml;
}
if (msg.options.timeout != null && msg.options.timeout > 0) {
toast.timeout = msg.options.timeout;
}
}
this.toasterService.popAsync(toast);
}
} }

View File

@ -79,9 +79,9 @@ import { UserService as UserServiceAbstraction } from 'jslib/abstractions/user.s
const logService = new ElectronLogService(); const logService = new ElectronLogService();
const i18nService = new I18nService(window.navigator.language, './locales'); const i18nService = new I18nService(window.navigator.language, './locales');
const stateService = new StateService(); const stateService = new StateService();
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, true);
const broadcasterService = new BroadcasterService(); const broadcasterService = new BroadcasterService();
const messagingService = new ElectronRendererMessagingService(broadcasterService); const messagingService = new ElectronRendererMessagingService(broadcasterService);
const platformUtilsService = new ElectronPlatformUtilsService(i18nService, messagingService, true);
const storageService: StorageServiceAbstraction = new LowdbStorageService(null, remote.app.getPath('userData')); const storageService: StorageServiceAbstraction = new LowdbStorageService(null, remote.app.getPath('userData'));
const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService(); const secureStorageService: StorageServiceAbstraction = new ElectronRendererSecureStorageService();
const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window, const cryptoFunctionService: CryptoFunctionServiceAbstraction = new WebCryptoFunctionService(window,

View File

@ -3,9 +3,6 @@ import {
OnChanges, OnChanges,
} from '@angular/core'; } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { AuditService } from 'jslib/abstractions/audit.service'; import { AuditService } from 'jslib/abstractions/audit.service';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
@ -22,10 +19,8 @@ import { AddEditComponent as BaseAddEditComponent } from 'jslib/angular/componen
export class AddEditComponent extends BaseAddEditComponent implements OnChanges { export class AddEditComponent extends BaseAddEditComponent implements OnChanges {
constructor(cipherService: CipherService, folderService: FolderService, constructor(cipherService: CipherService, folderService: FolderService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService, i18nService: I18nService, platformUtilsService: PlatformUtilsService,
analytics: Angulartics2, toasterService: ToasterService,
auditService: AuditService, stateService: StateService) { auditService: AuditService, stateService: StateService) {
super(cipherService, folderService, i18nService, platformUtilsService, analytics, super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService);
toasterService, auditService, stateService);
} }
async ngOnChanges() { async ngOnChanges() {

View File

@ -1,8 +1,5 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
@ -16,11 +13,9 @@ import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/
templateUrl: 'attachments.component.html', templateUrl: 'attachments.component.html',
}) })
export class AttachmentsComponent extends BaseAttachmentsComponent { export class AttachmentsComponent extends BaseAttachmentsComponent {
constructor(cipherService: CipherService, analytics: Angulartics2, constructor(cipherService: CipherService, i18nService: I18nService,
toasterService: ToasterService, i18nService: I18nService,
cryptoService: CryptoService, userService: UserService, cryptoService: CryptoService, userService: UserService,
platformUtilsService: PlatformUtilsService) { platformUtilsService: PlatformUtilsService) {
super(cipherService, analytics, toasterService, i18nService, cryptoService, userService, super(cipherService, i18nService, cryptoService, userService, platformUtilsService, window);
platformUtilsService, window);
} }
} }

View File

@ -1,6 +1,3 @@
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
@ -15,10 +12,8 @@ import { ExportComponent as BaseExportComponent } from 'jslib/angular/components
templateUrl: 'export.component.html', templateUrl: 'export.component.html',
}) })
export class ExportComponent extends BaseExportComponent { export class ExportComponent extends BaseExportComponent {
constructor(analytics: Angulartics2, toasterService: ToasterService, constructor(cryptoService: CryptoService, i18nService: I18nService,
cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService) { platformUtilsService: PlatformUtilsService, exportService: ExportService) {
super(analytics, toasterService, cryptoService, i18nService, platformUtilsService, super(cryptoService, i18nService, platformUtilsService, exportService, window);
exportService, window);
} }
} }

View File

@ -1,8 +1,5 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@ -17,8 +14,7 @@ import {
}) })
export class FolderAddEditComponent extends BaseFolderAddEditComponent { export class FolderAddEditComponent extends BaseFolderAddEditComponent {
constructor(folderService: FolderService, i18nService: I18nService, constructor(folderService: FolderService, i18nService: I18nService,
analytics: Angulartics2, toasterService: ToasterService,
platformUtilsService: PlatformUtilsService) { platformUtilsService: PlatformUtilsService) {
super(folderService, i18nService, analytics, toasterService, platformUtilsService); super(folderService, i18nService, platformUtilsService);
} }
} }

View File

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

View File

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

View File

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

View File

@ -7,9 +7,6 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { AuditService } from 'jslib/abstractions/audit.service'; import { AuditService } from 'jslib/abstractions/audit.service';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
@ -33,14 +30,13 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
@Output() onViewCipherPasswordHistory = new EventEmitter<CipherView>(); @Output() onViewCipherPasswordHistory = new EventEmitter<CipherView>();
constructor(cipherService: CipherService, totpService: TotpService, constructor(cipherService: CipherService, totpService: TotpService,
tokenService: TokenService, toasterService: ToasterService, tokenService: TokenService, i18nService: I18nService,
cryptoService: CryptoService, platformUtilsService: PlatformUtilsService, cryptoService: CryptoService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, analytics: Angulartics2,
auditService: AuditService, broadcasterService: BroadcasterService, auditService: AuditService, broadcasterService: BroadcasterService,
ngZone: NgZone, changeDetectorRef: ChangeDetectorRef, ngZone: NgZone, changeDetectorRef: ChangeDetectorRef,
userService: UserService) { userService: UserService) {
super(cipherService, totpService, tokenService, toasterService, cryptoService, platformUtilsService, super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService,
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef, userService); auditService, window, broadcasterService, ngZone, changeDetectorRef, userService);
} }
async ngOnChanges() { async ngOnChanges() {
@ -48,7 +44,7 @@ export class ViewComponent extends BaseViewComponent implements OnChanges {
} }
viewHistory() { viewHistory() {
this.analytics.eventTrack.next({ action: 'View Password History' }); this.platformUtilsService.eventTrack('View Password History');
this.onViewCipherPasswordHistory.emit(this.cipher); this.onViewCipherPasswordHistory.emit(this.cipher);
} }
} }