From efad05829e44c0fa001d36a4af52ccd762e08eb7 Mon Sep 17 00:00:00 2001 From: Sebastian Streich Date: Mon, 13 Jan 2025 14:30:47 +0100 Subject: [PATCH] FXVPN-246 Restore "open vpn" buttons --- src/background/vpncontroller/states.js | 1 + src/components/prefab-screens.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/background/vpncontroller/states.js b/src/background/vpncontroller/states.js index f81ca63..5986bf3 100644 --- a/src/background/vpncontroller/states.js +++ b/src/background/vpncontroller/states.js @@ -21,6 +21,7 @@ export const REQUEST_TYPES = [ "session_stop", "interventions", "settings", + "start", ]; export class VPNState { diff --git a/src/components/prefab-screens.js b/src/components/prefab-screens.js index 245eee2..f5cef2e 100644 --- a/src/components/prefab-screens.js +++ b/src/components/prefab-screens.js @@ -34,6 +34,15 @@ const sendToApp = (customElement, command = "") => { ); }; +const openVPN = (elm) => { + sendToApp(elm, "start"); +}; + +const openAuth = (elm) => { + sendToApp(elm, "focus"); + sendToApp(elm, "openAuth"); +}; + const defineMessageScreen = ( args = { tag, @@ -104,6 +113,8 @@ defineMessageScreen({ img: "message-signin.svg", heading: tr("headerSignedOut"), bodyText: tr("bodySignedOut"), + primaryAction: tr("btnOpenVpn"), + onPrimaryAction: openAuth, secondaryAction: tr("getHelp"), onSecondaryAction: () => closeAfter(() => open(getHelpUrl)), }); @@ -128,8 +139,8 @@ defineMessageScreen({ img: "message-open.svg", heading: tr("headerOpenMozillaVPN"), bodyText: html`

${tr("bodyOpenMsg")}

`, - onPrimaryAction: null, - primaryAction: null, + onPrimaryAction: openVPN, + primaryAction: tr("btnOpenVpn"), secondaryAction: tr("getHelp"), onSecondaryAction: () => closeAfter(() => open(getHelpUrl)), });