From 6acfba4b40ab86aea5c419ffb36c624fa39b75c7 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Wed, 14 Apr 2021 23:43:22 +0200 Subject: [PATCH] Remove dead code (#839) * Remove last remnants of old analytics code --- jslib | 2 +- package-lock.json | 5 ----- package.json | 1 - src/app/accounts/settings.component.ts | 21 +-------------------- src/app/app.component.ts | 11 +---------- src/app/app.module.ts | 7 ------- src/app/services.module.ts | 7 ------- src/app/vault/vault.component.ts | 3 +-- src/app/vault/view.component.ts | 1 - 9 files changed, 4 insertions(+), 54 deletions(-) diff --git a/jslib b/jslib index 0a0cdaa7..92df6330 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 0a0cdaa7fdfb7322c73258b270105c8fb6552b99 +Subproject commit 92df63304029049891a46d575612222fb9b6c325 diff --git a/package-lock.json b/package-lock.json index 928f1f0f..9423ed53 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1016,11 +1016,6 @@ "resolved": "https://registry.npmjs.org/angular2-toaster/-/angular2-toaster-8.0.0.tgz", "integrity": "sha512-MRDswCmhqFLBiot7C7SIq96NyU5aT9pwIVdYgmYJtXHp7N6fXk6QzuMSMhVvK12edUJntgmUft+SZfh45Oq0Wg==" }, - "angulartics2": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/angulartics2/-/angulartics2-9.1.0.tgz", - "integrity": "sha512-RAfHJSHyeRe834e5qCYLtp7fdFuKnz/myFTSVEUZV6nLp4cUotvX8XQhewUEpFv6gkrzJwcuY32JZxstDlNiXQ==" - }, "ansi-align": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", diff --git a/package.json b/package.json index bd2a274e..589a0482 100644 --- a/package.json +++ b/package.json @@ -305,7 +305,6 @@ "@microsoft/signalr-protocol-msgpack": "3.1.13", "@nodert-win10-rs4/windows.security.credentials.ui": "^0.4.4", "angular2-toaster": "8.0.0", - "angulartics2": "9.1.0", "big-integer": "1.6.48", "browser-hrtime": "^1.1.8", "core-js": "2.6.2", diff --git a/src/app/accounts/settings.component.ts b/src/app/accounts/settings.component.ts index faa7f45a..22200edc 100644 --- a/src/app/accounts/settings.component.ts +++ b/src/app/accounts/settings.component.ts @@ -3,8 +3,6 @@ import { OnInit, } from '@angular/core'; -import { ToasterService } from 'angular2-toaster'; -import { Angulartics2 } from 'angulartics2'; import Swal from 'sweetalert2/src/sweetalert2.js'; import { DeviceType } from 'jslib/enums/deviceType'; @@ -66,8 +64,7 @@ export class SettingsComponent implements OnInit { startToTrayText: string; startToTrayDescText: string; - constructor(private analytics: Angulartics2, private toasterService: ToasterService, - private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, + constructor(private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private storageService: StorageService, private vaultTimeoutService: VaultTimeoutService, private stateService: StateService, private messagingService: MessagingService, private userService: UserService, private cryptoService: CryptoService) { @@ -267,12 +264,10 @@ export class SettingsComponent implements OnInit { await this.storageService.save(ConstantsService.disableFaviconKey, this.disableFavicons); await this.stateService.save(ConstantsService.disableFaviconKey, this.disableFavicons); this.messagingService.send('refreshCiphers'); - this.callAnalytics('Favicons', !this.disableFavicons); } async saveMinToTray() { await this.storageService.save(ElectronConstants.enableMinimizeToTrayKey, this.enableMinToTray); - this.callAnalytics('MinimizeToTray', this.enableMinToTray); } async saveCloseToTray() { @@ -282,7 +277,6 @@ export class SettingsComponent implements OnInit { } await this.storageService.save(ElectronConstants.enableCloseToTrayKey, this.enableCloseToTray); - this.callAnalytics('CloseToTray', this.enableCloseToTray); } async saveTray() { @@ -304,7 +298,6 @@ export class SettingsComponent implements OnInit { } await this.storageService.save(ElectronConstants.enableTrayKey, this.enableTray); - this.callAnalytics('Tray', this.enableTray); this.messagingService.send(this.enableTray ? 'showTray' : 'removeTray'); } @@ -315,30 +308,23 @@ export class SettingsComponent implements OnInit { } await this.storageService.save(ElectronConstants.enableStartToTrayKey, this.startToTray); - this.callAnalytics('StartToTray', this.startToTray); } async saveLocale() { await this.storageService.save(ConstantsService.localeKey, this.locale); - this.analytics.eventTrack.next({ action: 'Set Locale ' + this.locale }); } async saveTheme() { await this.storageService.save(ConstantsService.themeKey, this.theme); - this.analytics.eventTrack.next({ action: 'Set Theme ' + this.theme }); window.setTimeout(() => window.location.reload(), 200); } async saveMinOnCopyToClipboard() { await this.storageService.save(ElectronConstants.minimizeOnCopyToClipboardKey, this.minimizeOnCopyToClipboard); - this.callAnalytics('MinOnCopyToClipboard', this.minimizeOnCopyToClipboard); } async saveClearClipboard() { await this.storageService.save(ConstantsService.clearClipboardKey, this.clearClipboard); - this.analytics.eventTrack.next({ - action: 'Set Clear Clipboard ' + (this.clearClipboard == null ? 'Disabled' : this.clearClipboard), - }); } async saveAlwaysShowDock() { @@ -381,9 +367,4 @@ export class SettingsComponent implements OnInit { async saveBrowserIntegrationFingerprint() { await this.storageService.save(ElectronConstants.enableBrowserIntegrationFingerprint, this.enableBrowserIntegrationFingerprint); } - - private callAnalytics(name: string, enabled: boolean) { - const status = enabled ? 'Enabled' : 'Disabled'; - this.analytics.eventTrack.next({ action: `${status} ${name}` }); - } } diff --git a/src/app/app.component.ts b/src/app/app.component.ts index c85f4e4b..f959f911 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -4,7 +4,6 @@ import { ToasterConfig, ToasterService, } from 'angular2-toaster'; -import { Angulartics2 } from 'angulartics2'; import { Component, @@ -100,7 +99,7 @@ export class AppComponent implements OnInit { private tokenService: TokenService, private folderService: FolderService, private settingsService: SettingsService, private syncService: SyncService, private passwordGenerationService: PasswordGenerationService, private cipherService: CipherService, - private authService: AuthService, private router: Router, private analytics: Angulartics2, + private authService: AuthService, private router: Router, private toasterService: ToasterService, private i18nService: I18nService, private sanitizer: DomSanitizer, private ngZone: NgZone, private vaultTimeoutService: VaultTimeoutService, private storageService: StorageService, @@ -195,12 +194,6 @@ export class AppComponent implements OnInit { case 'showToast': this.showToast(message); break; - case 'analyticsEventTrack': - this.analytics.eventTrack.next({ - action: message.action, - properties: { label: message.label }, - }); - break; case 'copiedToClipboard': if (!message.clearing) { this.systemService.clearClipboard(message.clipboardValue, message.clearMs); @@ -230,7 +223,6 @@ export class AppComponent implements OnInit { try { await this.syncService.fullSync(true, true); this.toasterService.popAsync('success', null, this.i18nService.t('syncingComplete')); - this.analytics.eventTrack.next({ action: 'Synced Full' }); } catch { this.toasterService.popAsync('error', null, this.i18nService.t('syncingFailed')); } @@ -367,7 +359,6 @@ export class AppComponent implements OnInit { this.vaultTimeoutService.biometricLocked = true; this.searchService.clearIndex(); this.authService.logOut(async () => { - this.analytics.eventTrack.next({ action: 'Logged Out' }); if (expired) { this.toasterService.popAsync('warning', this.i18nService.t('loggedOut'), this.i18nService.t('loginExpired')); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 8ef25e70..65f1b322 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,8 +2,6 @@ import 'core-js'; import 'zone.js/dist/zone'; import { ToasterModule } from 'angular2-toaster'; -import { Angulartics2Module } from 'angulartics2'; -import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; import { InfiniteScrollModule } from 'ngx-infinite-scroll'; import { AppRoutingModule } from './app-routing.module'; @@ -150,11 +148,6 @@ registerLocaleData(localeZhTw, 'zh-TW'); FormsModule, AppRoutingModule, ServicesModule, - Angulartics2Module.forRoot({ - pageTracking: { - clearQueryParams: true, - }, - }), ToasterModule.forRoot(), InfiniteScrollModule, DragDropModule, diff --git a/src/app/services.module.ts b/src/app/services.module.ts index c02c5986..d3caa7ce 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -22,8 +22,6 @@ import { AuthGuardService } from 'jslib/angular/services/auth-guard.service'; import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; import { ValidationService } from 'jslib/angular/services/validation.service'; -import { Analytics } from 'jslib/misc/analytics'; - import { ApiService } from 'jslib/services/api.service'; import { AppIdService } from 'jslib/services/appId.service'; import { AuditService } from 'jslib/services/audit.service'; @@ -138,7 +136,6 @@ const systemService = new SystemService(storageService, vaultTimeoutService, mes const nativeMessagingService = new NativeMessagingService(cryptoFunctionService, cryptoService, platformUtilsService, logService, i18nService, userService, messagingService, vaultTimeoutService, storageService); -const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService); containerService.attachToGlobal(window); export function initFactory(): Function { @@ -177,10 +174,6 @@ export function initFactory(): Function { if (installAction != null) { await storageService.save(ConstantsService.installedVersionKey, currentVersion); - analytics.ga('send', { - hitType: 'event', - eventAction: installAction, - }); } }; } diff --git a/src/app/vault/vault.component.ts b/src/app/vault/vault.component.ts index 08405bcc..3d9513fd 100644 --- a/src/app/vault/vault.component.ts +++ b/src/app/vault/vault.component.ts @@ -14,7 +14,6 @@ import { } from '@angular/router'; import { ToasterService } from 'angular2-toaster'; -import { Angulartics2 } from 'angulartics2'; import { BroadcasterService } from 'jslib/angular/services/broadcaster.service'; @@ -82,7 +81,7 @@ export class VaultComponent implements OnInit, OnDestroy { constructor(private route: ActivatedRoute, private router: Router, private componentFactoryResolver: ComponentFactoryResolver, private i18nService: I18nService, private broadcasterService: BroadcasterService, private changeDetectorRef: ChangeDetectorRef, - private ngZone: NgZone, private syncService: SyncService, private analytics: Angulartics2, + private ngZone: NgZone, private syncService: SyncService, private toasterService: ToasterService, private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService, private eventService: EventService, private totpService: TotpService, private userService: UserService) { } diff --git a/src/app/vault/view.component.ts b/src/app/vault/view.component.ts index f8e411d9..949b3ec7 100644 --- a/src/app/vault/view.component.ts +++ b/src/app/vault/view.component.ts @@ -68,7 +68,6 @@ export class ViewComponent extends BaseViewComponent implements OnChanges { } viewHistory() { - this.platformUtilsService.eventTrack('View Password History'); this.onViewCipherPasswordHistory.emit(this.cipher); }