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 { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@ -14,10 +12,9 @@ import { EnvironmentComponent as BaseEnvironmentComponent } from 'jslib/angular/
templateUrl: 'environment.component.html',
})
export class EnvironmentComponent extends BaseEnvironmentComponent {
constructor(analytics: Angulartics2, platformUtilsService: PlatformUtilsService,
environmentService: EnvironmentService, i18nService: I18nService,
private router: Router) {
super(analytics, platformUtilsService, environmentService, i18nService);
constructor(platformUtilsService: PlatformUtilsService, environmentService: EnvironmentService,
i18nService: I18nService, private router: Router) {
super(platformUtilsService, environmentService, i18nService);
this.showCustom = true;
}

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service';
import { I18nService } from 'jslib/abstractions/i18n.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',
})
export class HintComponent extends BaseHintComponent {
constructor(router: Router, analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
apiService: ApiService) {
super(router, analytics, i18nService, apiService, platformUtilsService);
constructor(router: Router, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, apiService: ApiService) {
super(router, i18nService, apiService, platformUtilsService);
}
}

View File

@ -4,8 +4,6 @@ import {
} from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.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',
})
export class LockComponent extends BaseLockComponent implements OnInit {
constructor(router: Router, analytics: Angulartics2,
i18nService: I18nService,
constructor(router: Router, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
userService: UserService, cryptoService: CryptoService) {
super(router, analytics, i18nService, platformUtilsService, messagingService, userService, cryptoService);
super(router, i18nService, platformUtilsService, messagingService, userService, cryptoService);
this.successRoute = '/tabs/current';
}

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { AuthService } from 'jslib/abstractions/auth.service';
import { I18nService } from 'jslib/abstractions/i18n.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 {
constructor(authService: AuthService, router: Router,
analytics: Angulartics2, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, syncService: SyncService, storageService: StorageService) {
super(authService, router, analytics, platformUtilsService, i18nService, storageService);
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
syncService: SyncService, storageService: StorageService) {
super(authService, router, platformUtilsService, i18nService, storageService);
super.onSuccessfulLogin = () => {
return syncService.fullSync(true);
};

View File

@ -1,8 +1,6 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service';
import { AuthService } from 'jslib/abstractions/auth.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 {
constructor(authService: AuthService, router: Router,
analytics: Angulartics2,
i18nService: I18nService, cryptoService: CryptoService,
apiService: ApiService, stateService: StateService,
platformUtilsService: PlatformUtilsService) {
super(authService, router, analytics, i18nService, cryptoService, apiService, stateService,
platformUtilsService);
super(authService, router, i18nService, cryptoService, apiService, stateService, platformUtilsService);
}
}

View File

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

View File

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

View File

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

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Location } from '@angular/common';
import { Component } from '@angular/core';
@ -16,10 +14,9 @@ import {
templateUrl: 'password-generator-history.component.html',
})
export class PasswordGeneratorHistoryComponent extends BasePasswordGeneratorHistoryComponent {
constructor(passwordGenerationService: PasswordGenerationService, analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
private location: Location) {
super(passwordGenerationService, analytics, platformUtilsService, i18nService, window);
constructor(passwordGenerationService: PasswordGenerationService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, private location: Location) {
super(passwordGenerationService, platformUtilsService, i18nService, window);
}
close() {

View File

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

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@ -15,11 +13,10 @@ import { ExportComponent as BaseExportComponent } from 'jslib/angular/components
templateUrl: 'export.component.html',
})
export class ExportComponent extends BaseExportComponent {
constructor(analytics: Angulartics2,
cryptoService: CryptoService, i18nService: I18nService,
constructor(cryptoService: CryptoService, i18nService: I18nService,
platformUtilsService: PlatformUtilsService, exportService: ExportService,
private router: Router) {
super(analytics, cryptoService, i18nService, platformUtilsService, exportService, window);
super(cryptoService, i18nService, platformUtilsService, exportService, window);
}
protected saved() {

View File

@ -4,8 +4,6 @@ import {
Router,
} from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
@ -20,10 +18,9 @@ import {
})
export class FolderAddEditComponent extends BaseFolderAddEditComponent {
constructor(folderService: FolderService, i18nService: I18nService,
analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, private router: Router,
private route: ActivatedRoute) {
super(folderService, i18nService, analytics, platformUtilsService);
super(folderService, i18nService, platformUtilsService);
}
async ngOnInit() {

View File

@ -1,8 +1,6 @@
import { CurrencyPipe } from '@angular/common';
import { Component } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ApiService } from 'jslib/abstractions/api.service';
import { I18nService } from 'jslib/abstractions/i18n.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 {
priceString: string;
constructor(analytics: Angulartics2,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
constructor(i18nService: I18nService, platformUtilsService: PlatformUtilsService,
tokenService: TokenService, apiService: ApiService,
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.
const thePrice = this.currencyPipe.transform(this.price, '$');

View File

@ -8,8 +8,6 @@ import {
Router,
} from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { AuditService } from 'jslib/abstractions/audit.service';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { FolderService } from 'jslib/abstractions/folder.service';
@ -28,12 +26,10 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit {
constructor(cipherService: CipherService, folderService: FolderService,
i18nService: I18nService, platformUtilsService: PlatformUtilsService,
analytics: Angulartics2,
auditService: AuditService, stateService: StateService,
private route: ActivatedRoute, private router: Router,
private location: Location) {
super(cipherService, folderService, i18nService, platformUtilsService, analytics,
auditService, stateService);
super(cipherService, folderService, i18nService, platformUtilsService, auditService, stateService);
}
ngOnInit() {

View File

@ -2,8 +2,6 @@ import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
@ -17,12 +15,11 @@ import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/
templateUrl: 'attachments.component.html',
})
export class AttachmentsComponent extends BaseAttachmentsComponent {
constructor(cipherService: CipherService, analytics: Angulartics2,
i18nService: I18nService,
constructor(cipherService: CipherService, i18nService: I18nService,
cryptoService: CryptoService, userService: UserService,
platformUtilsService: PlatformUtilsService, private location: Location,
private route: ActivatedRoute) {
super(cipherService, analytics, i18nService, cryptoService, userService, platformUtilsService, window);
super(cipherService, i18nService, cryptoService, userService, platformUtilsService, window);
}
async ngOnInit() {

View File

@ -1,5 +1,3 @@
import { Angulartics2 } from 'angulartics2';
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@ -17,10 +15,10 @@ import {
templateUrl: 'password-history.component.html',
})
export class PasswordHistoryComponent extends BasePasswordHistoryComponent {
constructor(cipherService: CipherService, analytics: Angulartics2,
platformUtilsService: PlatformUtilsService, i18nService: I18nService,
private location: Location, private route: ActivatedRoute) {
super(cipherService, analytics, platformUtilsService, i18nService, window);
constructor(cipherService: CipherService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, private location: Location,
private route: ActivatedRoute) {
super(cipherService, platformUtilsService, i18nService, window);
}
async ngOnInit() {

View File

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

View File

@ -1,4 +1,3 @@
import { ToasterService } from 'angular2-toaster';
import * as tldjs from 'tldjs';
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 {
return process.env.ENV === 'development';
}