From b5cc5409ff03d8e5f5b0fafba6185d2e93c62b2b Mon Sep 17 00:00:00 2001 From: Addison Beck Date: Wed, 23 Sep 2020 13:53:43 -0400 Subject: [PATCH] bug fix + added launch time to view component (#178) --- src/angular/components/view.component.ts | 6 +++++- src/models/domain/sortedCiphersCache.ts | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/angular/components/view.component.ts b/src/angular/components/view.component.ts index 067e6c6953f..cd8c0c4d954 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 e4e22ee9eef..133dc393136 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]; }