remove analytics in favor of platform utils

This commit is contained in:
Kyle Spearrin 2018-10-03 00:21:22 -04:00
parent 89a448b12f
commit adb3dc78ee
19 changed files with 50 additions and 86 deletions

2
jslib

@ -1 +1 @@
Subproject commit f793ff0aa57ef9ffcf09323d1f557c7c24509c1e Subproject commit 7ae640e5f8de3454fe8279aab2717abd6d12ca42

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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 { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@ -14,10 +12,9 @@ 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, platformUtilsService: PlatformUtilsService, constructor(platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
environmentService: EnvironmentService, i18nService: I18nService, i18nService: I18nService, private router: Router) {
private router: Router) { super(platformUtilsService, environmentService, i18nService);
super(analytics, platformUtilsService, environmentService, i18nService);
this.showCustom = true; this.showCustom = true;
} }

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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';
@ -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,
platformUtilsService: PlatformUtilsService, i18nService: I18nService, i18nService: I18nService, apiService: ApiService) {
apiService: ApiService) { super(router, i18nService, apiService, platformUtilsService);
super(router, analytics, i18nService, apiService, platformUtilsService);
} }
} }

View File

@ -4,8 +4,6 @@ import {
} from '@angular/core'; } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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';
@ -19,11 +17,10 @@ import { LockComponent as BaseLockComponent } from 'jslib/angular/components/loc
templateUrl: 'lock.component.html', templateUrl: 'lock.component.html',
}) })
export class LockComponent extends BaseLockComponent implements OnInit { export class LockComponent extends BaseLockComponent implements OnInit {
constructor(router: Router, analytics: Angulartics2, constructor(router: Router, i18nService: I18nService,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService, messagingService: MessagingService, platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
userService: UserService, cryptoService: CryptoService) { userService: UserService, cryptoService: CryptoService) {
super(router, analytics, i18nService, platformUtilsService, messagingService, userService, cryptoService); super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService);
this.successRoute = '/tabs/current'; this.successRoute = '/tabs/current';
} }

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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';
@ -17,9 +15,9 @@ import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/l
}) })
export class LoginComponent extends BaseLoginComponent { export class LoginComponent extends BaseLoginComponent {
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2, platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService, i18nService: I18nService,
i18nService: I18nService, syncService: SyncService, storageService: StorageService) { syncService: SyncService, storageService: StorageService) {
super(authService, router, analytics, platformUtilsService, 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,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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';
@ -18,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,
i18nService: I18nService, cryptoService: CryptoService, i18nService: I18nService, cryptoService: CryptoService,
apiService: ApiService, stateService: StateService, apiService: ApiService, stateService: StateService,
platformUtilsService: PlatformUtilsService) { platformUtilsService: PlatformUtilsService) {
super(authService, router, analytics, i18nService, cryptoService, apiService, stateService, super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService);
platformUtilsService);
} }
} }

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
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';
@ -17,9 +15,8 @@ import {
}) })
export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent { export class TwoFactorOptionsComponent extends BaseTwoFactorOptionsComponent {
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2,
i18nService: I18nService, platformUtilsService: PlatformUtilsService) { i18nService: I18nService, platformUtilsService: PlatformUtilsService) {
super(authService, router, analytics, i18nService, platformUtilsService, window); super(authService, router, i18nService, platformUtilsService, window);
} }
choose(p: any) { choose(p: any) {

View File

@ -6,8 +6,6 @@ import {
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { BrowserApi } from '../../browser/browserApi'; import { BrowserApi } from '../../browser/browserApi';
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType'; import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
@ -33,13 +31,11 @@ export class TwoFactorComponent extends BaseTwoFactorComponent {
showNewWindowMessage = false; showNewWindowMessage = false;
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2,
i18nService: I18nService, apiService: ApiService, i18nService: I18nService, apiService: ApiService,
platformUtilsService: PlatformUtilsService, syncService: SyncService, platformUtilsService: PlatformUtilsService, syncService: SyncService,
environmentService: EnvironmentService, private ngZone: NgZone, environmentService: EnvironmentService, private ngZone: NgZone,
private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef) { private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef) {
super(authService, router, analytics, i18nService, apiService, platformUtilsService, window, super(authService, router, i18nService, apiService, platformUtilsService, window, environmentService);
environmentService);
super.onSuccessfulLogin = () => { super.onSuccessfulLogin = () => {
return syncService.fullSync(true); return syncService.fullSync(true);
}; };

View File

@ -109,6 +109,11 @@ export class AppComponent implements OnInit {
await this.showToast(msg); await this.showToast(msg);
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
}); });
} else if (msg.command === 'analyticsEventTrack') {
this.analytics.eventTrack.next({
action: msg.action,
properties: { label: msg.label },
});
} else { } else {
msg.webExtSender = sender; msg.webExtSender = sender;
this.broadcasterService.send(msg); this.broadcasterService.send(msg);

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@ -16,10 +14,9 @@ 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, private location: Location) {
private location: Location) { super(passwordGenerationService, platformUtilsService, i18nService, window);
super(passwordGenerationService, analytics, platformUtilsService, i18nService, window);
} }
close() { close() {

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@ -21,10 +19,10 @@ import {
export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent { export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
private cipherState: CipherView; private cipherState: CipherView;
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2, constructor(passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService,
platformUtilsService: PlatformUtilsService, i18nService: I18nService, i18nService: I18nService, private stateService: StateService,
private stateService: StateService, private location: Location) { private location: Location) {
super(passwordGenerationService, analytics, platformUtilsService, i18nService, window); super(passwordGenerationService, platformUtilsService, i18nService, window);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
@ -15,11 +13,10 @@ 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, constructor(cryptoService: CryptoService, i18nService: I18nService,
cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService, platformUtilsService: PlatformUtilsService, exportService: ExportService,
private router: Router) { private router: Router) {
super(analytics, cryptoService, i18nService, platformUtilsService, exportService, window); super(cryptoService, i18nService, platformUtilsService, exportService, window);
} }
protected saved() { protected saved() {

View File

@ -4,8 +4,6 @@ import {
Router, Router,
} from '@angular/router'; } from '@angular/router';
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';
@ -20,10 +18,9 @@ import {
}) })
export class FolderAddEditComponent extends BaseFolderAddEditComponent { export class FolderAddEditComponent extends BaseFolderAddEditComponent {
constructor(folderService: FolderService, i18nService: I18nService, constructor(folderService: FolderService, i18nService: I18nService,
analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, private router: Router, platformUtilsService: PlatformUtilsService, private router: Router,
private route: ActivatedRoute) { private route: ActivatedRoute) {
super(folderService, i18nService, analytics, platformUtilsService); super(folderService, i18nService, platformUtilsService);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -1,8 +1,6 @@
import { CurrencyPipe } from '@angular/common'; import { CurrencyPipe } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
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';
@ -17,11 +15,10 @@ import { PremiumComponent as BasePremiumComponent } from 'jslib/angular/componen
export class PremiumComponent extends BasePremiumComponent { export class PremiumComponent extends BasePremiumComponent {
priceString: string; priceString: string;
constructor(analytics: Angulartics2, constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
tokenService: TokenService, apiService: ApiService, tokenService: TokenService, apiService: ApiService,
private currencyPipe: CurrencyPipe) { private currencyPipe: CurrencyPipe) {
super(analytics, i18nService, platformUtilsService, tokenService, apiService); super(i18nService, platformUtilsService, tokenService, apiService);
// Support old price string. Can be removed in future once all translations are properly updated. // Support old price string. Can be removed in future once all translations are properly updated.
const thePrice = this.currencyPipe.transform(this.price, '$'); const thePrice = this.currencyPipe.transform(this.price, '$');

View File

@ -8,8 +8,6 @@ import {
Router, Router,
} from '@angular/router'; } from '@angular/router';
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';
@ -28,12 +26,10 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit {
constructor(cipherService: CipherService, folderService: FolderService, constructor(cipherService: CipherService, folderService: FolderService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService, i18nService: I18nService, platformUtilsService: PlatformUtilsService,
analytics: Angulartics2,
auditService: AuditService, stateService: StateService, auditService: AuditService, stateService: StateService,
private route: ActivatedRoute, private router: Router, private route: ActivatedRoute, private router: Router,
private location: Location) { private location: Location) {
super(cipherService, folderService, i18nService, platformUtilsService, analytics, super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService);
auditService, stateService);
} }
ngOnInit() { ngOnInit() {

View File

@ -2,8 +2,6 @@ import { Location } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
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';
@ -17,12 +15,11 @@ 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,
i18nService: I18nService,
cryptoService: CryptoService, userService: UserService, cryptoService: CryptoService, userService: UserService,
platformUtilsService: PlatformUtilsService, private location: Location, platformUtilsService: PlatformUtilsService, private location: Location,
private route: ActivatedRoute) { private route: ActivatedRoute) {
super(cipherService, analytics, i18nService, cryptoService, userService, platformUtilsService, window); super(cipherService, i18nService, cryptoService, userService, platformUtilsService, window);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
@ -17,10 +15,10 @@ 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, private location: Location,
private location: Location, private route: ActivatedRoute) { private route: ActivatedRoute) {
super(cipherService, analytics, platformUtilsService, i18nService, window); super(cipherService, platformUtilsService, i18nService, window);
} }
async ngOnInit() { async ngOnInit() {

View File

@ -9,8 +9,6 @@ import {
Router, Router,
} from '@angular/router'; } from '@angular/router';
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';
@ -32,15 +30,14 @@ export class ViewComponent extends BaseViewComponent {
showAttachments = true; showAttachments = true;
constructor(cipherService: CipherService, totpService: TotpService, constructor(cipherService: CipherService, totpService: TotpService,
tokenService: TokenService, tokenService: TokenService, i18nService: I18nService,
cryptoService: CryptoService, platformUtilsService: PlatformUtilsService, cryptoService: CryptoService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, analytics: Angulartics2,
auditService: AuditService, private route: ActivatedRoute, auditService: AuditService, private route: ActivatedRoute,
private router: Router, private location: Location, private router: Router, private location: Location,
broadcasterService: BroadcasterService, ngZone: NgZone, broadcasterService: BroadcasterService, ngZone: NgZone,
changeDetectorRef: ChangeDetectorRef, userService: UserService) { changeDetectorRef: ChangeDetectorRef, userService: UserService) {
super(cipherService, totpService, tokenService, cryptoService, platformUtilsService, super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService,
i18nService, analytics, auditService, window, broadcasterService, ngZone, changeDetectorRef, userService); auditService, window, broadcasterService, ngZone, changeDetectorRef, userService);
} }
ngOnInit() { ngOnInit() {

View File

@ -1,4 +1,3 @@
import { ToasterService } from 'angular2-toaster';
import * as tldjs from 'tldjs'; import * as tldjs from 'tldjs';
import { BrowserApi } from '../browser/browserApi'; import { BrowserApi } from '../browser/browserApi';
@ -203,6 +202,14 @@ export default class BrowserPlatformUtilsService implements PlatformUtilsService
}); });
} }
eventTrack(action: string, label?: string, options?: any) {
this.messagingService.send('analyticsEventTrack', {
action: action,
label: label,
options: options,
});
}
isDev(): boolean { isDev(): boolean {
return process.env.ENV === 'development'; return process.env.ENV === 'development';
} }