1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

Add login launch data (#174)

* added launch time data to CipherView for autofill

* removed unused code

* fixed linter errors
This commit is contained in:
Addison Beck
2020-09-23 12:41:25 -04:00
committed by GitHub
parent 5cb3e9c965
commit 26d40d4c43
3 changed files with 55 additions and 4 deletions

View File

@@ -23,6 +23,10 @@ export class SortedCiphersCache {
return this.isCached(url) ? this.sortedCiphersByUrl.get(url).getLastUsed() : null;
}
getLastLaunched(url: string) {
return this.isCached(url) ? this.sortedCiphersByUrl.get(url).getLastLaunched() : null;
}
getNext(url: string) {
this.resetTimer(url);
return this.isCached(url) ? this.sortedCiphersByUrl.get(url).getNext() : null;
@@ -52,6 +56,11 @@ class Ciphers {
return this.ciphers[this.lastUsedIndex];
}
getLastLaunched() {
const sortedCiphers = this.ciphers.sort((x, y) => y.localData?.lastLaunched?.valueOf() - x.localData?.lastLaunched?.valueOf());
return sortedCiphers[0];
}
getNext() {
const nextIndex = (this.lastUsedIndex + 1) % this.ciphers.length;
this.lastUsedIndex = nextIndex;