tracked last-launched ciphers for autofill

This commit is contained in:
Addison Beck 2020-10-12 13:33:26 -04:00
parent c86151d74f
commit fdfb6fb152
4 changed files with 13 additions and 2 deletions

2
jslib

@ -1 +1 @@
Subproject commit e371d737b0d3db99f195c3317ecf9eaa16bd19b3
Subproject commit 9e9795fd855d643459a9205c5299bfbf887d4985

View File

@ -15,6 +15,7 @@ import {
import { BrowserApi } from '../../browser/browserApi';
import { CipherService } from 'jslib/abstractions/cipher.service';
import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service';
@ -62,7 +63,8 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
private changeDetectorRef: ChangeDetectorRef, private stateService: StateService,
private popupUtils: PopupUtilsService, private i18nService: I18nService,
private folderService: FolderService, private collectionService: CollectionService,
private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService) {
private analytics: Angulartics2, private platformUtilsService: PlatformUtilsService,
private cipherService: CipherService) {
super(searchService);
this.pageSize = 100;
this.applySavedState = (window as any).previousPopupUrl != null &&
@ -195,6 +197,7 @@ export class CiphersComponent extends BaseCiphersComponent implements OnInit, On
}
this.preventSelected = true;
this.analytics.eventTrack.next({ action: 'Launched URI From Listing' });
await this.cipherService.updateLastLaunchedDate(cipher.id);
BrowserApi.createNewTab(cipher.login.launchUri);
if (this.popupUtils.inPopup(window)) {
BrowserApi.closePopup(window);

View File

@ -286,6 +286,7 @@ export class GroupingsComponent extends BaseGroupingsComponent implements OnInit
}
this.preventSelected = true;
this.analytics.eventTrack.next({ action: 'Launched URI From Listing' });
await this.cipherService.updateLastLaunchedDate(cipher.id);
BrowserApi.createNewTab(cipher.login.launchUri);
if (this.popupUtils.inPopup(window)) {
BrowserApi.closePopup(window);

View File

@ -232,6 +232,13 @@ export default class AutofillService implements AutofillServiceInterface {
cipher = await this.cipherService.getNextCipherForUrl(tab.url);
} else {
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
const lastLaunchedCipher = await this.cipherService.getLastLaunchedForUrl(tab.url);
if (lastLaunchedCipher && Date.now().valueOf() - lastLaunchedCipher.localData?.lastLaunched?.valueOf() < 30000) {
cipher = lastLaunchedCipher;
}
else {
cipher = await this.cipherService.getLastUsedForUrl(tab.url);
}
}
const autoFillResponse = await this.doAutoFill({