collection event for autofill

This commit is contained in:
Kyle Spearrin 2019-07-12 14:54:17 -04:00
parent 7bfb8d91e3
commit fd04be2d98
2 changed files with 9 additions and 4 deletions

View File

@ -168,9 +168,12 @@ export default class MainBackground {
this.syncService = new SyncService(this.userService, this.apiService, this.settingsService,
this.folderService, this.cipherService, this.cryptoService, this.collectionService,
this.storageService, this.messagingService, async (expired: boolean) => await this.logout(expired));
this.eventService = new EventService(this.storageService, this.apiService, this.userService,
this.cipherService);
this.passwordGenerationService = new PasswordGenerationService(this.cryptoService, this.storageService);
this.totpService = new TotpService(this.storageService, cryptoFunctionService);
this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService);
this.autofillService = new AutofillService(this.cipherService, this.userService, this.totpService,
this.eventService);
this.containerService = new ContainerService(this.cryptoService);
this.auditService = new AuditService(cryptoFunctionService, this.apiService);
this.exportService = new ExportService(this.folderService, this.cipherService, this.apiService);
@ -180,8 +183,6 @@ 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() ||

View File

@ -17,6 +17,9 @@ import {
UserService,
} from 'jslib/abstractions';
import { EventService } from 'jslib/abstractions/event.service';
import { EventType } from 'jslib/enums/eventType';
const CardAttributes: string[] = ['autoCompleteType', 'data-stripe', 'htmlName', 'htmlID', 'label-tag',
'placeholder', 'label-left', 'label-top'];
@ -105,7 +108,7 @@ var IsoProvinces: { [id: string]: string; } = {
export default class AutofillService implements AutofillServiceInterface {
constructor(private cipherService: CipherService, private userService: UserService,
private totpService: TotpService) { }
private totpService: TotpService, private eventService: EventService) { }
getFormsWithPasswordFields(pageDetails: AutofillPageDetails): any[] {
const formData: any[] = [];
@ -189,6 +192,7 @@ export default class AutofillService implements AutofillServiceInterface {
});
if (didAutofill) {
this.eventService.collect(EventType.Cipher_ClientAutofilled, options.cipher.id);
if (totpPromise != null) {
return await totpPromise;
} else {