commit a63b4b06c538bbae7727feeb290ce87e1e52fdd4 parent cbbb6c1d645d363c185a6a65dcb200e73f48804e Author: Rebecca King <rking@mozilla.com> Date: Wed, 12 Nov 2025 15:32:46 +0000 Bug 1997327 - Update ipprotection-message-bar to be able to handle info messages - r=ip-protection-reviewers,fluent-reviewers,bolsson,kpatenio Differential Revision: https://phabricator.services.mozilla.com/D270735 Diffstat:
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/browser/components/ipprotection/content/ipprotection-content.mjs b/browser/components/ipprotection/content/ipprotection-content.mjs @@ -206,11 +206,12 @@ export default class IPProtectionContentElement extends MozLitElement { } messageBarTemplate() { - // Fallback to a generic error + // TODO: Set messageId based on state in Bug 1997328 return html` <ipprotection-message-bar class="vpn-top-content" - type=${ERRORS.GENERIC} + type=${this.#hasErrors ? ERRORS.GENERIC : "info"} + messageId="ipprotection-message-continuous-onboarding-1" ></ipprotection-message-bar> `; } @@ -322,11 +323,16 @@ export default class IPProtectionContentElement extends MozLitElement { } render() { - if (this.#hasErrors && !this._messageDismissed) { + // TODO: Set showContinuousOnboarding based on state Bug 1997328 + if ( + (this.#hasErrors || this.showContinuousOnboarding) && + !this._messageDismissed + ) { this._showMessageBar = true; } const messageBar = this._showMessageBar ? this.messageBarTemplate() : null; + //TODO: Check state to determine what position to add the message bar Bug 1997328 const content = html`${messageBar}${this.mainContentTemplate()}`; // TODO: Conditionally render post-upgrade subview within #ipprotection-content-wrapper - Bug 1973813 diff --git a/browser/components/ipprotection/content/ipprotection-message-bar.mjs b/browser/components/ipprotection/content/ipprotection-message-bar.mjs @@ -14,6 +14,7 @@ import "chrome://global/content/elements/moz-message-bar.mjs"; export default class IPProtectionMessageBarElement extends MozLitElement { #MESSAGE_TYPE_MAP = new Map([ ["generic-error", () => this.genericErrorTemplate()], + ["info", () => this.infoMessageTemplate()], ]); DISMISS_EVENT = "ipprotection-message-bar:user-dismissed"; @@ -23,6 +24,7 @@ export default class IPProtectionMessageBarElement extends MozLitElement { static properties = { type: { type: String }, + messageId: { type: String }, }; constructor() { @@ -58,6 +60,13 @@ export default class IPProtectionMessageBarElement extends MozLitElement { `; } + infoMessageTemplate() { + return html` + <moz-message-bar type="info" data-l10n-id=${this.messageId} dismissable> + </moz-message-bar> + `; + } + firstUpdated() { this.mozMessageBarEl.addEventListener( "message-bar:user-dismissed", diff --git a/browser/locales-preview/ipProtection.ftl b/browser/locales-preview/ipProtection.ftl @@ -74,6 +74,9 @@ ipprotection-message-generic-error = .heading = Couldn’t connect to VPN .message = Try again in a few minutes. +ipprotection-message-continuous-onboarding-1 = + .message = Turn on VPN to hide your location and add extra encryption to your browsing. + ## IP Protection Settings ip-protection-description =