async updateMozVpnStatusDependentUi()

in src/js/popup.js [1626:1666]


      async updateMozVpnStatusDependentUi() {
        const mozillaVpnInstalled = await browser.runtime.sendMessage({ method: "MozillaVPN_getInstallationStatus" });
        const mozillaVpnConnected = await browser.runtime.sendMessage({ method: "MozillaVPN_getConnectionStatus" });

        this.subtitle.textContent = browser.i18n.getMessage("integrateContainers");

        const bothMozillaVpnPermissionsEnabled = await MozillaVPN.bothPermissionsEnabled();

        if (mozillaVpnInstalled && !bothMozillaVpnPermissionsEnabled) {
          this.subtitle.style.flex = "1 1 100%";
          this.classList.remove("show-server-button");
          this.subtitle.textContent = browser.i18n.getMessage("additionalPermissionNeeded");
          this.hideEls(this.hideShowButton, this.switch, this.switchLabel, this.currentServerButton);
          this.primaryCta.style.display = "block";
          this.primaryCta.textContent = browser.i18n.getMessage("enable");
          return;
        }

        if (mozillaVpnInstalled) {
          // Hide cta and hide/show button
          this.hideEls(this.primaryCta, this.hideShowButton);

          // Update subtitle
          this.subtitle.textContent = mozillaVpnConnected ? browser.i18n.getMessage("useCustomLocation") : browser.i18n.getMessage("mozillaVpnMustBeOn");
          this.subtitle.style.flex = "1 1 80%";
          this.currentServerButton.style.display = "flex";
        }

        if (mozillaVpnConnected) {
          [this.switchLabel, this.switch].forEach(el => {
            el.style.display = "inline-block";
          });
        } else {
          this.hideEls(this.switch, this.switchLabel, this.currentServerButton);
          this.switch.checked = false;
        }

        if ((mozillaVpnInstalled && !mozillaVpnConnected) || mozillaVpnConnected) {
          this.expandUi();
        }
      }