diff --git a/src/angular/components/view.component.ts b/src/angular/components/view.component.ts index 067e6c6953..cd8c0c4d95 100644 --- a/src/angular/components/view.component.ts +++ b/src/angular/components/view.component.ts @@ -196,11 +196,15 @@ export class ViewComponent implements OnDestroy, OnInit { } } - launch(uri: LoginUriView) { + launch(uri: LoginUriView, cipherId?: string) { if (!uri.canLaunch) { return; } + if (cipherId) { + this.cipherService.updateLastLaunchedDate(cipherId); + } + this.platformUtilsService.eventTrack('Launched Login URI'); this.platformUtilsService.launchUri(uri.launchUri); } diff --git a/src/models/domain/sortedCiphersCache.ts b/src/models/domain/sortedCiphersCache.ts index e4e22ee9ee..133dc39313 100644 --- a/src/models/domain/sortedCiphersCache.ts +++ b/src/models/domain/sortedCiphersCache.ts @@ -57,7 +57,8 @@ class Ciphers { } getLastLaunched() { - const sortedCiphers = this.ciphers.sort((x, y) => y.localData?.lastLaunched?.valueOf() - x.localData?.lastLaunched?.valueOf()); + const usedCiphers = this.ciphers.filter(cipher => cipher.localData?.lastLaunched) + const sortedCiphers = usedCiphers.sort((x, y) => y.localData.lastLaunched.valueOf() - x.localData.lastLaunched.valueOf()); return sortedCiphers[0]; }