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

move eventTrack analytics to platform utils

This commit is contained in:
Kyle Spearrin 2018-10-03 00:03:49 -04:00
parent f793ff0aa5
commit ad31527b8d
20 changed files with 52 additions and 104 deletions

8
package-lock.json generated
View File

@ -229,14 +229,6 @@
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
"dev": true
},
"angulartics2": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/angulartics2/-/angulartics2-6.3.0.tgz",
"integrity": "sha512-5BwRYCLF6ypBl7rlarW403v4AdotIldJhN+2rQeTIw/rTtngJ4SewNhf4zlRnKBSItlhbZRrDJBl9uR2TUuCdw==",
"requires": {
"tslib": "^1.9.0"
}
},
"ansi-align": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz",

View File

@ -69,7 +69,6 @@
"@angular/upgrade": "6.1.7",
"@aspnet/signalr": "1.0.3",
"@aspnet/signalr-protocol-msgpack": "1.0.3",
"angulartics2": "6.3.0",
"core-js": "2.5.7",
"electron-log": "2.2.14",
"electron-updater": "3.0.3",

View File

@ -25,6 +25,7 @@ export abstract class PlatformUtilsService {
options?: any) => void;
showDialog: (text: string, title?: string, confirmText?: string, cancelText?: string,
type?: string) => Promise<boolean>;
eventTrack: (action: string, label?: string, options?: any) => void;
isDev: () => boolean;
isSelfHost: () => boolean;
copyToClipboard: (text: string, options?: any) => void;

View File

@ -4,8 +4,6 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { CipherType } from '../../enums/cipherType';
import { FieldType } from '../../enums/fieldType';
import { SecureNoteType } from '../../enums/secureNoteType';
@ -60,7 +58,6 @@ export class AddEditComponent {
constructor(protected cipherService: CipherService, protected folderService: FolderService,
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
protected analytics: Angulartics2,
protected auditService: AuditService, protected stateService: StateService) {
this.typeOptions = [
{ name: i18nService.t('typeLogin'), value: CipherType.Login },
@ -167,7 +164,7 @@ export class AddEditComponent {
this.formPromise = this.saveCipher(cipher);
await this.formPromise;
this.cipher.id = cipher.id;
this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Cipher' : 'Added Cipher' });
this.platformUtilsService.eventTrack(this.editMode ? 'Edited Cipher' : 'Added Cipher');
this.platformUtilsService.showToast('success', null,
this.i18nService.t(this.editMode ? 'editedItem' : 'addedItem'));
this.onSavedCipher.emit(this.cipher);
@ -236,7 +233,7 @@ export class AddEditComponent {
try {
this.deletePromise = this.deleteCipher();
await this.deletePromise;
this.analytics.eventTrack.next({ action: 'Deleted Cipher' });
this.platformUtilsService.eventTrack('Deleted Cipher');
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedItem'));
this.onDeletedCipher.emit(this.cipher);
} catch { }
@ -259,13 +256,13 @@ export class AddEditComponent {
}
togglePassword() {
this.analytics.eventTrack.next({ action: 'Toggled Password on Edit' });
this.platformUtilsService.eventTrack('Toggled Password on Edit');
this.showPassword = !this.showPassword;
document.getElementById('loginPassword').focus();
}
toggleCardCode() {
this.analytics.eventTrack.next({ action: 'Toggled CardCode on Edit' });
this.platformUtilsService.eventTrack('Toggled CardCode on Edit');
this.showCardCode = !this.showCardCode;
document.getElementById('cardCode').focus();
}
@ -294,7 +291,7 @@ export class AddEditComponent {
return;
}
this.analytics.eventTrack.next({ action: 'Check Password' });
this.platformUtilsService.eventTrack('Check Password');
this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password);
const matches = await this.checkPasswordPromise;
this.checkPasswordPromise = null;

View File

@ -5,8 +5,6 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from '../../abstractions/cipher.service';
import { CryptoService } from '../../abstractions/crypto.service';
import { I18nService } from '../../abstractions/i18n.service';
@ -30,8 +28,7 @@ export class AttachmentsComponent implements OnInit {
formPromise: Promise<any>;
deletePromises: { [id: string]: Promise<any>; } = {};
constructor(protected cipherService: CipherService, protected analytics: Angulartics2,
protected i18nService: I18nService,
constructor(protected cipherService: CipherService, protected i18nService: I18nService,
protected cryptoService: CryptoService, protected userService: UserService,
protected platformUtilsService: PlatformUtilsService, protected win: Window) { }
@ -85,7 +82,7 @@ export class AttachmentsComponent implements OnInit {
this.formPromise = this.saveCipherAttachment(files[0]);
this.cipherDomain = await this.formPromise;
this.cipher = await this.cipherDomain.decrypt();
this.analytics.eventTrack.next({ action: 'Added Attachment' });
this.platformUtilsService.eventTrack('Added Attachment');
this.platformUtilsService.showToast('success', null, this.i18nService.t('attachmentSaved'));
this.onUploadedAttachment.emit();
} catch { }
@ -112,7 +109,7 @@ export class AttachmentsComponent implements OnInit {
try {
this.deletePromises[attachment.id] = this.deleteCipherAttachment(attachment.id);
await this.deletePromises[attachment.id];
this.analytics.eventTrack.next({ action: 'Deleted Attachment' });
this.platformUtilsService.eventTrack('Deleted Attachment');
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedAttachment'));
const i = this.cipher.attachments.indexOf(attachment);
if (i > -1) {

View File

@ -3,8 +3,6 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentService } from '../../abstractions/environment.service';
import { I18nService } from '../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
@ -20,8 +18,8 @@ export class EnvironmentComponent {
baseUrl: string;
showCustom = false;
constructor(protected analytics: Angulartics2, protected platformUtilsService: PlatformUtilsService,
protected environmentService: EnvironmentService, protected i18nService: I18nService) {
constructor(protected platformUtilsService: PlatformUtilsService, protected environmentService: EnvironmentService,
protected i18nService: I18nService) {
this.baseUrl = environmentService.baseUrl || '';
this.webVaultUrl = environmentService.webVaultUrl || '';
this.apiUrl = environmentService.apiUrl || '';
@ -48,7 +46,7 @@ export class EnvironmentComponent {
this.iconsUrl = resUrls.icons;
this.notificationsUrl = resUrls.notifications;
this.analytics.eventTrack.next({ action: 'Set Environment URLs' });
this.platformUtilsService.eventTrack('Set Environment URLs');
this.platformUtilsService.showToast('success', null, this.i18nService.t('environmentSaved'));
this.saved();
}

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import {
EventEmitter,
Output,
@ -17,8 +15,7 @@ export class ExportComponent {
masterPassword: string;
showPassword = false;
constructor(protected analytics: Angulartics2,
protected cryptoService: CryptoService, protected i18nService: I18nService,
constructor(protected cryptoService: CryptoService, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected exportService: ExportService,
protected win: Window) { }
@ -35,7 +32,7 @@ export class ExportComponent {
try {
this.formPromise = this.getExportData();
const data = await this.formPromise;
this.analytics.eventTrack.next({ action: 'Exported Data' });
this.platformUtilsService.eventTrack('Exported Data');
this.downloadFile(data);
this.saved();
} catch { }
@ -46,7 +43,7 @@ export class ExportComponent {
}
togglePassword() {
this.analytics.eventTrack.next({ action: 'Toggled Master Password on Export' });
this.platformUtilsService.eventTrack('Toggled Master Password on Export');
this.showPassword = !this.showPassword;
document.getElementById('masterPassword').focus();
}

View File

@ -5,8 +5,6 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { FolderService } from '../../abstractions/folder.service';
import { I18nService } from '../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
@ -25,7 +23,7 @@ export class FolderAddEditComponent implements OnInit {
deletePromise: Promise<any>;
constructor(protected folderService: FolderService, protected i18nService: I18nService,
protected analytics: Angulartics2, protected platformUtilsService: PlatformUtilsService) { }
protected platformUtilsService: PlatformUtilsService) { }
async ngOnInit() {
this.editMode = this.folderId != null;
@ -51,7 +49,7 @@ export class FolderAddEditComponent implements OnInit {
const folder = await this.folderService.encrypt(this.folder);
this.formPromise = this.folderService.saveWithServer(folder);
await this.formPromise;
this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Folder' : 'Added Folder' });
this.platformUtilsService.eventTrack(this.editMode ? 'Edited Folder' : 'Added Folder');
this.platformUtilsService.showToast('success', null,
this.i18nService.t(this.editMode ? 'editedFolder' : 'addedFolder'));
this.onSavedFolder.emit(this.folder);
@ -72,7 +70,7 @@ export class FolderAddEditComponent implements OnInit {
try {
this.deletePromise = this.folderService.deleteWithServer(this.folder.id);
await this.deletePromise;
this.analytics.eventTrack.next({ action: 'Deleted Folder' });
this.platformUtilsService.eventTrack('Deleted Folder');
this.platformUtilsService.showToast('success', null, this.i18nService.t('deletedFolder'));
this.onDeletedFolder.emit(this.folder);
} catch { }

View File

@ -1,5 +1,4 @@
import {
Component,
EventEmitter,
Input,
Output,

View File

@ -1,7 +1,5 @@
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { PasswordHintRequest } from '../../models/request/passwordHintRequest';
import { ApiService } from '../../abstractions/api.service';
@ -14,9 +12,8 @@ export class HintComponent {
protected successRoute = 'login';
constructor(protected router: Router, protected analytics: Angulartics2,
protected i18nService: I18nService, protected apiService: ApiService,
protected platformUtilsService: PlatformUtilsService) { }
constructor(protected router: Router, protected i18nService: I18nService,
protected apiService: ApiService, protected platformUtilsService: PlatformUtilsService) { }
async submit() {
if (this.email == null || this.email === '') {
@ -33,7 +30,7 @@ export class HintComponent {
try {
this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email));
await this.formPromise;
this.analytics.eventTrack.next({ action: 'Requested Hint' });
this.platformUtilsService.eventTrack('Requested Hint');
this.platformUtilsService.showToast('success', null, this.i18nService.t('masterPassSent'));
this.router.navigate([this.successRoute]);
} catch { }

View File

@ -1,7 +1,5 @@
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { CryptoService } from '../../abstractions/crypto.service';
import { I18nService } from '../../abstractions/i18n.service';
import { MessagingService } from '../../abstractions/messaging.service';
@ -14,8 +12,7 @@ export class LockComponent {
protected successRoute: string = 'vault';
constructor(protected router: Router, protected analytics: Angulartics2,
protected i18nService: I18nService,
constructor(protected router: Router, protected i18nService: I18nService,
protected platformUtilsService: PlatformUtilsService, protected messagingService: MessagingService,
protected userService: UserService, protected cryptoService: CryptoService) { }
@ -52,7 +49,7 @@ export class LockComponent {
}
togglePassword() {
this.analytics.eventTrack.next({ action: 'Toggled Master Password on Unlock' });
this.platformUtilsService.eventTrack('Toggled Master Password on Unlock');
this.showPassword = !this.showPassword;
document.getElementById('masterPassword').focus();
}

View File

@ -4,8 +4,6 @@ import {
} from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { AuthResult } from '../../models/domain/authResult';
import { AuthService } from '../../abstractions/auth.service';
@ -34,8 +32,8 @@ export class LoginComponent implements OnInit {
protected successRoute = 'vault';
constructor(protected authService: AuthService, protected router: Router,
protected analytics: Angulartics2, protected platformUtilsService: PlatformUtilsService,
protected i18nService: I18nService, private storageService: StorageService) { }
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
private storageService: StorageService) { }
async ngOnInit() {
if (this.email == null || this.email === '') {
@ -80,13 +78,13 @@ export class LoginComponent implements OnInit {
await this.storageService.remove(Keys.rememberedEmail);
}
if (response.twoFactor) {
this.analytics.eventTrack.next({ action: 'Logged In To Two-step' });
this.platformUtilsService.eventTrack('Logged In To Two-step');
this.router.navigate([this.twoFactorRoute]);
} else {
if (this.onSuccessfulLogin != null) {
this.onSuccessfulLogin();
}
this.analytics.eventTrack.next({ action: 'Logged In' });
this.platformUtilsService.eventTrack('Logged In');
if (this.onSuccessfulLoginNavigate != null) {
this.onSuccessfulLoginNavigate();
} else {
@ -97,7 +95,7 @@ export class LoginComponent implements OnInit {
}
togglePassword() {
this.analytics.eventTrack.next({ action: 'Toggled Master Password on Login' });
this.platformUtilsService.eventTrack('Toggled Master Password on Login');
this.showPassword = !this.showPassword;
document.getElementById('masterPassword').focus();
}

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { OnInit } from '@angular/core';
import { I18nService } from '../../abstractions/i18n.service';
@ -11,7 +9,7 @@ import { GeneratedPasswordHistory } from '../../models/domain/generatedPasswordH
export class PasswordGeneratorHistoryComponent implements OnInit {
history: GeneratedPasswordHistory[] = [];
constructor(protected passwordGenerationService: PasswordGenerationService, protected analytics: Angulartics2,
constructor(protected passwordGenerationService: PasswordGenerationService,
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
private win: Window) { }
@ -25,7 +23,7 @@ export class PasswordGeneratorHistoryComponent implements OnInit {
}
copy(password: string) {
this.analytics.eventTrack.next({ action: 'Copied Historical Password' });
this.platformUtilsService.eventTrack('Copied Historical Password');
const copyOptions = this.win != null ? { window: this.win } : null;
this.platformUtilsService.copyToClipboard(password, copyOptions);
this.platformUtilsService.showToast('info', null,

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import {
EventEmitter,
Input,
@ -20,7 +18,7 @@ export class PasswordGeneratorComponent implements OnInit {
showOptions = false;
avoidAmbiguous = false;
constructor(protected passwordGenerationService: PasswordGenerationService, protected analytics: Angulartics2,
constructor(protected passwordGenerationService: PasswordGenerationService,
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
private win: Window) { }
@ -28,14 +26,14 @@ export class PasswordGeneratorComponent implements OnInit {
this.options = await this.passwordGenerationService.getOptions();
this.avoidAmbiguous = !this.options.ambiguous;
this.password = await this.passwordGenerationService.generatePassword(this.options);
this.analytics.eventTrack.next({ action: 'Generated Password' });
this.platformUtilsService.eventTrack('Generated Password');
await this.passwordGenerationService.addHistory(this.password);
}
async sliderChanged() {
this.saveOptions(false);
await this.passwordGenerationService.addHistory(this.password);
this.analytics.eventTrack.next({ action: 'Regenerated Password' });
this.platformUtilsService.eventTrack('Regenerated Password');
}
async sliderInput() {
@ -55,11 +53,11 @@ export class PasswordGeneratorComponent implements OnInit {
async regenerate() {
this.password = await this.passwordGenerationService.generatePassword(this.options);
await this.passwordGenerationService.addHistory(this.password);
this.analytics.eventTrack.next({ action: 'Regenerated Password' });
this.platformUtilsService.eventTrack('Regenerated Password');
}
copy() {
this.analytics.eventTrack.next({ action: 'Copied Generated Password' });
this.platformUtilsService.eventTrack('Copied Generated Password');
const copyOptions = this.win != null ? { window: this.win } : null;
this.platformUtilsService.copyToClipboard(this.password, copyOptions);
this.platformUtilsService.showToast('info', null,
@ -67,7 +65,7 @@ export class PasswordGeneratorComponent implements OnInit {
}
select() {
this.analytics.eventTrack.next({ action: 'Selected Generated Password' });
this.platformUtilsService.eventTrack('Selected Generated Password');
this.onSelected.emit(this.password);
}

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { OnInit } from '@angular/core';
import { CipherService } from '../../abstractions/cipher.service';
@ -12,9 +10,8 @@ export class PasswordHistoryComponent implements OnInit {
cipherId: string;
history: PasswordHistoryView[] = [];
constructor(protected cipherService: CipherService, protected analytics: Angulartics2,
protected platformUtilsService: PlatformUtilsService, protected i18nService: I18nService,
private win: Window) { }
constructor(protected cipherService: CipherService, protected platformUtilsService: PlatformUtilsService,
protected i18nService: I18nService, private win: Window) { }
async ngOnInit() {
const cipher = await this.cipherService.get(this.cipherId);
@ -23,7 +20,7 @@ export class PasswordHistoryComponent implements OnInit {
}
copy(password: string) {
this.analytics.eventTrack.next({ action: 'Copied Password History' });
this.platformUtilsService.eventTrack('Copied Password History');
const copyOptions = this.win != null ? { window: this.win } : null;
this.platformUtilsService.copyToClipboard(password, copyOptions);
this.platformUtilsService.showToast('info', null,

View File

@ -1,7 +1,5 @@
import { OnInit } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from '../../abstractions/api.service';
import { I18nService } from '../../abstractions/i18n.service';
import { PlatformUtilsService } from '../../abstractions/platformUtils.service';
@ -12,8 +10,7 @@ export class PremiumComponent implements OnInit {
price: number = 10;
refreshPromise: Promise<any>;
constructor(protected analytics: Angulartics2,
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
constructor(protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
protected tokenService: TokenService, protected apiService: ApiService) { }
async ngOnInit() {
@ -33,7 +30,7 @@ export class PremiumComponent implements OnInit {
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumPurchaseAlert'),
this.i18nService.t('premiumPurchase'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
if (confirmed) {
this.analytics.eventTrack.next({ action: 'Clicked Purchase Premium' });
this.platformUtilsService.eventTrack('Clicked Purchase Premium');
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase');
}
}
@ -42,7 +39,7 @@ export class PremiumComponent implements OnInit {
const confirmed = await this.platformUtilsService.showDialog(this.i18nService.t('premiumManageAlert'),
this.i18nService.t('premiumManage'), this.i18nService.t('yes'), this.i18nService.t('cancel'));
if (confirmed) {
this.analytics.eventTrack.next({ action: 'Clicked Manage Membership' });
this.platformUtilsService.eventTrack('Clicked Manage Membership');
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=manage');
}
}

View File

@ -1,7 +1,5 @@
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { KeysRequest } from '../../models/request/keysRequest';
import { RegisterRequest } from '../../models/request/registerRequest';
@ -26,7 +24,6 @@ export class RegisterComponent {
protected successRoute = 'login';
constructor(protected authService: AuthService, protected router: Router,
protected analytics: Angulartics2,
protected i18nService: I18nService, protected cryptoService: CryptoService,
protected apiService: ApiService, protected stateService: StateService,
protected platformUtilsService: PlatformUtilsService) { }
@ -79,14 +76,14 @@ export class RegisterComponent {
try {
this.formPromise = this.apiService.postRegister(request);
await this.formPromise;
this.analytics.eventTrack.next({ action: 'Registered' });
this.platformUtilsService.eventTrack('Registered');
this.platformUtilsService.showToast('success', null, this.i18nService.t('newAccountCreated'));
this.router.navigate([this.successRoute], { queryParams: { email: this.email } });
} catch { }
}
togglePassword(confirmField: boolean) {
this.analytics.eventTrack.next({ action: 'Toggled Master Password on Register' });
this.platformUtilsService.eventTrack('Toggled Master Password on Register');
this.showPassword = !this.showPassword;
document.getElementById(confirmField ? 'masterPasswordRetype' : 'masterPassword').focus();
}

View File

@ -6,8 +6,6 @@ import {
} from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
import { AuthService } from '../../abstractions/auth.service';
@ -21,7 +19,6 @@ export class TwoFactorOptionsComponent implements OnInit {
providers: any[] = [];
constructor(protected authService: AuthService, protected router: Router,
protected analytics: Angulartics2,
protected i18nService: I18nService, protected platformUtilsService: PlatformUtilsService,
protected win: Window) { }
@ -34,7 +31,7 @@ export class TwoFactorOptionsComponent implements OnInit {
}
recover() {
this.analytics.eventTrack.next({ action: 'Selected Recover' });
this.platformUtilsService.eventTrack('Selected Recover');
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/lost-two-step-device/');
this.onRecoverSelected.emit();
}

View File

@ -4,8 +4,6 @@ import {
} from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { DeviceType } from '../../enums/deviceType';
import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
@ -42,7 +40,6 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
protected successRoute = 'vault';
constructor(protected authService: AuthService, protected router: Router,
protected analytics: Angulartics2,
protected i18nService: I18nService, protected apiService: ApiService,
protected platformUtilsService: PlatformUtilsService, protected win: Window,
protected environmentService: EnvironmentService) {
@ -168,7 +165,7 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
if (this.onSuccessfulLogin != null) {
this.onSuccessfulLogin();
}
this.analytics.eventTrack.next({ action: 'Logged In From Two-step' });
this.platformUtilsService.eventTrack('Logged In From Two-step');
if (this.onSuccessfulLoginNavigate != null) {
this.onSuccessfulLoginNavigate();
} else {

View File

@ -8,8 +8,6 @@ import {
Output,
} from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { CipherType } from '../../enums/cipherType';
import { FieldType } from '../../enums/fieldType';
@ -49,9 +47,8 @@ export class ViewComponent implements OnDestroy, OnInit {
private totpInterval: any;
constructor(protected cipherService: CipherService, protected totpService: TotpService,
protected tokenService: TokenService,
protected tokenService: TokenService, protected i18nService: I18nService,
protected cryptoService: CryptoService, protected platformUtilsService: PlatformUtilsService,
protected i18nService: I18nService, protected analytics: Angulartics2,
protected auditService: AuditService, protected win: Window,
protected broadcasterService: BroadcasterService, protected ngZone: NgZone,
protected changeDetectorRef: ChangeDetectorRef, protected userService: UserService) { }
@ -100,12 +97,12 @@ export class ViewComponent implements OnDestroy, OnInit {
}
togglePassword() {
this.analytics.eventTrack.next({ action: 'Toggled Password' });
this.platformUtilsService.eventTrack('Toggled Password');
this.showPassword = !this.showPassword;
}
toggleCardCode() {
this.analytics.eventTrack.next({ action: 'Toggled Card Code' });
this.platformUtilsService.eventTrack('Toggled Card Code');
this.showCardCode = !this.showCardCode;
}
@ -114,7 +111,7 @@ export class ViewComponent implements OnDestroy, OnInit {
return;
}
this.analytics.eventTrack.next({ action: 'Check Password' });
this.platformUtilsService.eventTrack('Check Password');
this.checkPasswordPromise = this.auditService.passwordLeaked(this.cipher.login.password);
const matches = await this.checkPasswordPromise;
@ -136,7 +133,7 @@ export class ViewComponent implements OnDestroy, OnInit {
return;
}
this.analytics.eventTrack.next({ action: 'Launched Login URI' });
this.platformUtilsService.eventTrack('Launched Login URI');
this.platformUtilsService.launchUri(uri.uri);
}
@ -145,7 +142,7 @@ export class ViewComponent implements OnDestroy, OnInit {
return;
}
this.analytics.eventTrack.next({ action: 'Copied ' + aType });
this.platformUtilsService.eventTrack('Copied ' + aType);
const copyOptions = this.win != null ? { window: this.win } : null;
this.platformUtilsService.copyToClipboard(value, copyOptions);
this.platformUtilsService.showToast('info', null,