mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
Add premium dialog when trying to navigate to attachments without premium permissions (#11387)
This commit is contained in:
parent
f82563ee23
commit
8ec5517809
@ -207,6 +207,7 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
|
|||||||
private accountService: AccountService,
|
private accountService: AccountService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private billingAccountProfileStateService: BillingAccountProfileStateService,
|
private billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||||
|
private premiumUpgradeService: PremiumUpgradePromptService,
|
||||||
) {
|
) {
|
||||||
this.updateTitle();
|
this.updateTitle();
|
||||||
}
|
}
|
||||||
@ -297,6 +298,13 @@ export class VaultItemDialogComponent implements OnInit, OnDestroy {
|
|||||||
};
|
};
|
||||||
|
|
||||||
openAttachmentsDialog = async () => {
|
openAttachmentsDialog = async () => {
|
||||||
|
const canAccessAttachments = await firstValueFrom(this.canAccessAttachments$);
|
||||||
|
|
||||||
|
if (!canAccessAttachments) {
|
||||||
|
await this.premiumUpgradeService.promptForPremium();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const dialogRef = this.dialogService.open<AttachmentDialogCloseResult, { cipherId: CipherId }>(
|
const dialogRef = this.dialogService.open<AttachmentDialogCloseResult, { cipherId: CipherId }>(
|
||||||
AttachmentsV2Component,
|
AttachmentsV2Component,
|
||||||
{
|
{
|
||||||
|
@ -611,6 +611,12 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
const result = await lastValueFrom(this.vaultItemDialogRef.closed);
|
const result = await lastValueFrom(this.vaultItemDialogRef.closed);
|
||||||
this.vaultItemDialogRef = undefined;
|
this.vaultItemDialogRef = undefined;
|
||||||
|
|
||||||
|
// When the dialog is closed for a premium upgrade, return early as the user
|
||||||
|
// should be navigated to the subscription settings elsewhere
|
||||||
|
if (result === VaultItemDialogResult.PremiumUpgrade) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the dialog was closed by deleting the cipher, refresh the vault.
|
// If the dialog was closed by deleting the cipher, refresh the vault.
|
||||||
if (result === VaultItemDialogResult.Deleted || result === VaultItemDialogResult.Saved) {
|
if (result === VaultItemDialogResult.Deleted || result === VaultItemDialogResult.Saved) {
|
||||||
this.refresh();
|
this.refresh();
|
||||||
|
Loading…
Reference in New Issue
Block a user