From a9d9130f01c00703a2557f9de192bee41798fbad Mon Sep 17 00:00:00 2001 From: Shane Melton Date: Thu, 24 Oct 2024 10:51:38 -0700 Subject: [PATCH] [PM-13907] [PM-13849] Browser Refresh - Improve launch login UX (#11680) * [PM-13907] Move canLaunch logic to CipherView * [PM-13907] Add external link icon to vault list items * [PM-13907] Remove launch option from more options dropdown * [PM-13849] Add double click to launch support --- apps/browser/src/_locales/en/messages.json | 9 +++ .../item-more-options.component.html | 3 - .../item-more-options.component.ts | 26 -------- .../vault-list-items-container.component.html | 11 ++++ .../vault-list-items-container.component.ts | 59 +++++++++++++++++-- .../src/vault/models/view/cipher.view.ts | 10 +++- 6 files changed, 82 insertions(+), 36 deletions(-) diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index 087dbbd9dfe..1424533e739 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -578,6 +578,15 @@ "launchWebsite": { "message": "Launch website" }, + "launchWebsiteName": { + "message": "Launch website $ITEMNAME$", + "placeholders": { + "itemname": { + "content": "$1", + "example": "Secret item" + } + } + }, "website": { "message": "Website" }, diff --git a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html index 03287c75fa9..cedd7736ba7 100644 --- a/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html +++ b/apps/browser/src/vault/popup/components/vault-v2/item-more-options/item-more-options.component.html @@ -17,9 +17,6 @@ {{ "fillAndSave" | i18n }} - + + + { + try { + const repromptPassed = await this.passwordRepromptService.passwordRepromptCheck(cipher); + if (!repromptPassed) { + return; + } + await this.router.navigate(["/view-cipher"], { + queryParams: { cipherId: cipher.id, type: cipher.type }, + }); + } finally { + // Ensure the timeout is always cleared + this.viewCipherTimeout = null; + } + }, + cipher.canLaunch ? 200 : 0, + ); } } diff --git a/libs/common/src/vault/models/view/cipher.view.ts b/libs/common/src/vault/models/view/cipher.view.ts index 028b582db26..3ea3f109be1 100644 --- a/libs/common/src/vault/models/view/cipher.view.ts +++ b/libs/common/src/vault/models/view/cipher.view.ts @@ -2,9 +2,8 @@ import { View } from "../../../models/view/view"; import { InitializerMetadata } from "../../../platform/interfaces/initializer-metadata.interface"; import { InitializerKey } from "../../../platform/services/cryptography/initializer-key"; import { DeepJsonify } from "../../../types/deep-jsonify"; -import { LinkedIdType } from "../../enums"; +import { CipherType, LinkedIdType } from "../../enums"; import { CipherRepromptType } from "../../enums/cipher-reprompt-type"; -import { CipherType } from "../../enums/cipher-type"; import { LocalData } from "../data/local.data"; import { Cipher } from "../domain/cipher"; @@ -132,6 +131,13 @@ export class CipherView implements View, InitializerMetadata { ); } + /** + * Determines if the cipher can be launched in a new browser tab. + */ + get canLaunch(): boolean { + return this.type === CipherType.Login && this.login.canLaunch; + } + linkedFieldValue(id: LinkedIdType) { const linkedFieldOption = this.linkedFieldOptions?.get(id); if (linkedFieldOption == null) {