From 7dd11511c6f1b45a5f1e415f6dbf8f0035fc2abb Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 9 Jul 2019 13:11:10 -0400 Subject: [PATCH] event logging on view page --- jslib | 2 +- src/app/app.component.ts | 5 ++++- src/app/services.module.ts | 5 +++++ src/app/vault/view.component.html | 3 ++- src/app/vault/view.component.ts | 5 +++-- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/jslib b/jslib index 74c3019858..7bdca0dcb4 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 74c30198587e1c799dfa16c2eb2771ff12c2eebe +Subproject commit 7bdca0dcb4bbe8983157d555740db5ed229d5948 diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f0bb08f0c3..983d15f027 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -33,6 +33,7 @@ import { AuthService } from 'jslib/abstractions/auth.service'; import { CipherService } from 'jslib/abstractions/cipher.service'; import { CollectionService } from 'jslib/abstractions/collection.service'; import { CryptoService } from 'jslib/abstractions/crypto.service'; +import { EventService } from 'jslib/abstractions/event.service'; import { FolderService } from 'jslib/abstractions/folder.service'; import { I18nService } from 'jslib/abstractions/i18n.service'; import { LockService } from 'jslib/abstractions/lock.service'; @@ -94,7 +95,7 @@ export class AppComponent implements OnInit { private messagingService: MessagingService, private collectionService: CollectionService, private searchService: SearchService, private notificationsService: NotificationsService, private platformUtilsService: PlatformUtilsService, private systemService: SystemService, - private stateService: StateService) { } + private stateService: StateService, private eventService: EventService) { } ngOnInit() { this.ngZone.runOutsideAngular(() => { @@ -209,9 +210,11 @@ export class AppComponent implements OnInit { } private 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/app/services.module.ts b/src/app/services.module.ts index 609c8e824e..ec35338768 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -33,6 +33,7 @@ import { ConstantsService } from 'jslib/services/constants.service'; import { ContainerService } from 'jslib/services/container.service'; import { CryptoService } from 'jslib/services/crypto.service'; import { EnvironmentService } from 'jslib/services/environment.service'; +import { EventService } from 'jslib/services/event.service'; import { ExportService } from 'jslib/services/export.service'; import { FolderService } from 'jslib/services/folder.service'; import { LockService } from 'jslib/services/lock.service'; @@ -57,6 +58,7 @@ import { CollectionService as CollectionServiceAbstraction } from 'jslib/abstrac import { CryptoService as CryptoServiceAbstraction } from 'jslib/abstractions/crypto.service'; import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from 'jslib/abstractions/cryptoFunction.service'; import { EnvironmentService as EnvironmentServiceAbstraction } from 'jslib/abstractions/environment.service'; +import { EventService as EventServiceAbstraction } from 'jslib/abstractions/event.service'; import { ExportService as ExportServiceAbstraction } from 'jslib/abstractions/export.service'; import { FolderService as FolderServiceAbstraction } from 'jslib/abstractions/folder.service'; import { I18nService as I18nServiceAbstraction } from 'jslib/abstractions/i18n.service'; @@ -117,6 +119,7 @@ const auditService = new AuditService(cryptoFunctionService, apiService); const notificationsService = new NotificationsService(userService, syncService, appIdService, apiService, lockService, async () => messagingService.send('logout', { expired: true })); const environmentService = new EnvironmentService(apiService, storageService, notificationsService); +const eventService = new EventService(storageService, apiService, userService, cipherService); const systemService = new SystemService(storageService, lockService, messagingService, platformUtilsService, null); const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService); @@ -129,6 +132,7 @@ export function initFactory(): Function { lockService.init(true); const locale = await storageService.get(ConstantsService.localeKey); await i18nService.init(locale); + eventService.init(true); authService.init(); setTimeout(() => notificationsService.init(environmentService), 3000); const htmlEl = window.document.documentElement; @@ -195,6 +199,7 @@ export function initFactory(): Function { { provide: SearchServiceAbstraction, useValue: searchService }, { provide: NotificationsServiceAbstraction, useValue: notificationsService }, { provide: SystemServiceAbstraction, useValue: systemService }, + { provide: EventServiceAbstraction, useValue: eventService }, { provide: APP_INITIALIZER, useFactory: initFactory, diff --git a/src/app/vault/view.component.html b/src/app/vault/view.component.html index 3cb38aa7e6..5b62dd318e 100644 --- a/src/app/vault/view.component.html +++ b/src/app/vault/view.component.html @@ -224,7 +224,8 @@ + (click)="copy(field.value, 'value', field.type === fieldType.Hidden ? 'H_Field' : 'Field')" + role="button"> diff --git a/src/app/vault/view.component.ts b/src/app/vault/view.component.ts index 9ccfd4ab5e..9d0a840f62 100644 --- a/src/app/vault/view.component.ts +++ b/src/app/vault/view.component.ts @@ -10,6 +10,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'; @@ -34,9 +35,9 @@ export class ViewComponent extends BaseViewComponent implements OnChanges { cryptoService: CryptoService, platformUtilsService: PlatformUtilsService, auditService: AuditService, broadcasterService: BroadcasterService, ngZone: NgZone, changeDetectorRef: ChangeDetectorRef, - userService: UserService) { + userService: UserService, eventService: EventService) { super(cipherService, totpService, tokenService, i18nService, cryptoService, platformUtilsService, - auditService, window, broadcasterService, ngZone, changeDetectorRef, userService); + auditService, window, broadcasterService, ngZone, changeDetectorRef, userService, eventService); } async ngOnChanges() {