From 4045ce2d157f2087d0080258d68a442be64064e5 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Wed, 27 Jan 2021 15:34:14 +1000 Subject: [PATCH 1/2] Pass launchCipher down to grandchild for reuse --- src/popup/components/action-buttons.component.ts | 11 ++--------- src/popup/components/ciphers-list.component.html | 3 ++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/popup/components/action-buttons.component.ts b/src/popup/components/action-buttons.component.ts index 909d20b8e25..605ca6f63ab 100644 --- a/src/popup/components/action-buttons.component.ts +++ b/src/popup/components/action-buttons.component.ts @@ -29,6 +29,7 @@ import { PopupUtilsService } from '../services/popup-utils.service'; }) export class ActionButtonsComponent { @Output() onView = new EventEmitter(); + @Output() onLaunch = new EventEmitter(); @Input() cipher: CipherView; @Input() showView = false; @@ -45,15 +46,7 @@ export class ActionButtonsComponent { } launch() { - if (this.cipher.type !== CipherType.Login || !this.cipher.login.canLaunch) { - return; - } - - this.analytics.eventTrack.next({ action: 'Launched URI From Listing' }); - BrowserApi.createNewTab(this.cipher.login.launchUri); - if (this.popupUtilsService.inPopup(window)) { - BrowserApi.closePopup(window); - } + this.onLaunch.emit(this.cipher); } async copy(cipher: CipherView, value: string, typeI18nKey: string, aType: string) { diff --git a/src/popup/components/ciphers-list.component.html b/src/popup/components/ciphers-list.component.html index 33c585ad1f3..39217fe5c13 100644 --- a/src/popup/components/ciphers-list.component.html +++ b/src/popup/components/ciphers-list.component.html @@ -17,6 +17,7 @@ {{c.subTitle}} - + From ea1a1cc99b6eb74a9008aa0b20a7c5334cba550b Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Thu, 28 Jan 2021 07:45:54 +1000 Subject: [PATCH 2/2] Use consistent naming convention for launchCipher --- src/popup/components/action-buttons.component.html | 2 +- src/popup/components/action-buttons.component.ts | 6 +++--- src/popup/components/ciphers-list.component.html | 4 ++-- src/popup/components/ciphers-list.component.ts | 6 +++--- src/popup/vault/ciphers.component.html | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/popup/components/action-buttons.component.html b/src/popup/components/action-buttons.component.html index 5d81817e9ca..a3caa2c9337 100644 --- a/src/popup/components/action-buttons.component.html +++ b/src/popup/components/action-buttons.component.html @@ -2,7 +2,7 @@ - diff --git a/src/popup/components/action-buttons.component.ts b/src/popup/components/action-buttons.component.ts index 605ca6f63ab..8cc92d88422 100644 --- a/src/popup/components/action-buttons.component.ts +++ b/src/popup/components/action-buttons.component.ts @@ -29,7 +29,7 @@ import { PopupUtilsService } from '../services/popup-utils.service'; }) export class ActionButtonsComponent { @Output() onView = new EventEmitter(); - @Output() onLaunch = new EventEmitter(); + @Output() launchEvent = new EventEmitter(); @Input() cipher: CipherView; @Input() showView = false; @@ -45,8 +45,8 @@ export class ActionButtonsComponent { this.userHasPremiumAccess = await this.userService.canAccessPremium(); } - launch() { - this.onLaunch.emit(this.cipher); + launchCipher() { + this.launchEvent.emit(this.cipher); } async copy(cipher: CipherView, value: string, typeI18nKey: string, aType: string) { diff --git a/src/popup/components/ciphers-list.component.html b/src/popup/components/ciphers-list.component.html index 39217fe5c13..6c8c4a407b3 100644 --- a/src/popup/components/ciphers-list.component.html +++ b/src/popup/components/ciphers-list.component.html @@ -1,4 +1,4 @@ -
@@ -17,7 +17,7 @@ {{c.subTitle}}
-
diff --git a/src/popup/components/ciphers-list.component.ts b/src/popup/components/ciphers-list.component.ts index 81b477af3d0..4c1101826c6 100644 --- a/src/popup/components/ciphers-list.component.ts +++ b/src/popup/components/ciphers-list.component.ts @@ -15,7 +15,7 @@ import { CipherView } from 'jslib/models/view/cipherView'; }) export class CiphersListComponent { @Output() onSelected = new EventEmitter(); - @Output() onDoubleSelected = new EventEmitter(); + @Output() launchEvent = new EventEmitter(); @Output() onView = new EventEmitter(); @Input() ciphers: CipherView[]; @Input() showView = false; @@ -27,8 +27,8 @@ export class CiphersListComponent { this.onSelected.emit(c); } - doubleSelectCipher(c: CipherView) { - this.onDoubleSelected.emit(c); + launchCipher(c: CipherView) { + this.launchEvent.emit(c); } viewCipher(c: CipherView) { diff --git a/src/popup/vault/ciphers.component.html b/src/popup/vault/ciphers.component.html index 05f4eeb0946..3581afa21d1 100644 --- a/src/popup/vault/ciphers.component.html +++ b/src/popup/vault/ciphers.component.html @@ -72,7 +72,7 @@
+ (onSelected)="selectCipher($event)" (launchEvent)="launchCipher($event)">