From 1fece3079f4c59030af872a801e66498d1d5f160 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 9 Jul 2019 13:56:13 -0400 Subject: [PATCH] event logging on view page --- jslib | 2 +- src/background/main.background.ts | 8 ++++++++ src/popup/vault/view.component.html | 2 +- src/popup/vault/view.component.ts | 6 ++++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/jslib b/jslib index 2830121471..7bdca0dcb4 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 2830121471fb7c6dca6de934c5f28520294fbffb +Subproject commit 7bdca0dcb4bbe8983157d555740db5ed229d5948 diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 382b8e4980..496263e098 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -19,6 +19,7 @@ import { TotpService, UserService, } from 'jslib/services'; +import { EventService } from 'jslib/services/event.service'; import { ExportService } from 'jslib/services/export.service'; import { NotificationsService } from 'jslib/services/notifications.service'; import { SearchService } from 'jslib/services/search.service'; @@ -46,6 +47,7 @@ import { TotpService as TotpServiceAbstraction, UserService as UserServiceAbstraction, } from 'jslib/abstractions'; +import { EventService as EventServiceAbstraction } from 'jslib/abstractions/event.service'; import { ExportService as ExportServiceAbstraction } from 'jslib/abstractions/export.service'; import { NotificationsService as NotificationsServiceAbstraction } from 'jslib/abstractions/notifications.service'; import { SearchService as SearchServiceAbstraction } from 'jslib/abstractions/search.service'; @@ -100,6 +102,7 @@ export default class MainBackground { searchService: SearchServiceAbstraction; notificationsService: NotificationsServiceAbstraction; systemService: SystemServiceAbstraction; + eventService: EventServiceAbstraction; analytics: Analytics; onUpdatedRan: boolean; @@ -177,6 +180,8 @@ export default class MainBackground { this.notificationsService); this.analytics = new Analytics(window, () => BrowserApi.gaFilter(), this.platformUtilsService, this.storageService, this.appIdService); + this.eventService = new EventService(this.storageService, this.apiService, this.userService, + this.cipherService); this.systemService = new SystemService(this.storageService, this.lockService, this.messagingService, this.platformUtilsService, () => { const forceWindowReload = this.platformUtilsService.isSafari() || @@ -214,6 +219,7 @@ export default class MainBackground { await (this.lockService as LockService).init(true); await (this.i18nService as I18nService).init(); + await (this.eventService as EventService).init(true); await this.runtimeBackground.init(); await this.tabsBackground.init(); await this.commandsBackground.init(); @@ -281,9 +287,11 @@ export default class MainBackground { } async logout(expired: boolean) { + await this.eventService.uploadEvents(); const userId = await this.userService.getUserId(); await Promise.all([ + this.eventService.clearEvents(), this.syncService.setLastSync(new Date(0)), this.tokenService.clearToken(), this.cryptoService.clearKeys(), diff --git a/src/popup/vault/view.component.html b/src/popup/vault/view.component.html index cbd5a5e603..21a1629685 100644 --- a/src/popup/vault/view.component.html +++ b/src/popup/vault/view.component.html @@ -229,7 +229,7 @@ + (click)="copy(field.value, 'value', field.type === fieldType.Hidden ? 'H_Field' : 'Field')"> diff --git a/src/popup/vault/view.component.ts b/src/popup/vault/view.component.ts index bfad14d6ac..005ecec922 100644 --- a/src/popup/vault/view.component.ts +++ b/src/popup/vault/view.component.ts @@ -12,6 +12,7 @@ import { import { AuditService } from 'jslib/abstractions/audit.service'; import { CipherService } from 'jslib/abstractions/cipher.service'; import { CryptoService } from 'jslib/abstractions/crypto.service'; +import { EventService } from 'jslib/abstractions/event.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { TokenService } from 'jslib/abstractions/token.service'; @@ -35,9 +36,10 @@ export class ViewComponent extends BaseViewComponent { auditService: AuditService, private route: ActivatedRoute, private router: Router, private location: Location, broadcasterService: BroadcasterService, ngZone: NgZone, - changeDetectorRef: ChangeDetectorRef, userService: UserService) { + changeDetectorRef: ChangeDetectorRef, userService: UserService, + eventService: EventService) { super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService, - auditService, window, broadcasterService, ngZone, changeDetectorRef, userService); + auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService); } ngOnInit() {