${bodyText}
` : bodyText; @@ -34,10 +45,12 @@ const defineMessageScreen = ( this.img = img; this.heading = heading; this.primaryAction = primaryAction; + this.secondaryAction = secondaryAction; this.onPrimaryAction = onPrimaryAction; - this.secondaryAction = secondarAction; this.onSecondaryAction = onSecondaryAction; this.identifier = tag; + this.totalPages = totalPages; + this.currentPage = currentPage; render(body, this); } } @@ -60,7 +73,7 @@ defineMessageScreen( tr("bodySubscribeNow"), tr("btnSubscribeNow"), () => { - open("https://www.mozilla.org/products/vpn#pricing"); + () => closeAfter (()=>open("https://www.mozilla.org/products/vpn#pricing")); } ); @@ -71,7 +84,7 @@ defineMessageScreen( tr("bodyNeedsUpdate2"), tr("btnDownloadNow"), () => { - open("https://www.mozilla.org/products/vpn/download/"); + () => closeAfter (()=>open("https://www.mozilla.org/products/vpn/download/")); } ); @@ -92,7 +105,7 @@ defineMessageScreen( `, tr("btnDownloadNow"), () => { - open("https://www.mozilla.org/products/vpn/download/"); + () => closeAfter (()=>open("https://www.mozilla.org/products/vpn/download/")); } ); @@ -105,6 +118,29 @@ defineMessageScreen( null ); +// Need to start loop at 1 because of how the strings were added to l10n repo. +for (let i = 1; i <= NUMBER_OF_ONBOARDING_PAGES; i++) { + const isFinalScreen = i === NUMBER_OF_ONBOARDING_PAGES; + defineMessageScreen( + `onboarding-screen-${i}`, + `onboarding-${i}.svg`, + tr(`onboarding${i}_title`), + html`${tr(`onboarding${i}_body`)}
`, + isFinalScreen ? tr("done") : tr("next"), + () => { + isFinalScreen + ? onboardingController.finishOnboarding() + : onboardingController.nextOnboardingPage(); + }, + isFinalScreen ? tr(" ") : tr("skip"), // For final screen need a space - when using something like `null` there is a large vertical gap + () => { + isFinalScreen ? null : onboardingController.finishOnboarding(); + }, + NUMBER_OF_ONBOARDING_PAGES, + i + ); +} + defineMessageScreen( "unsupported-os-message-screen", "message-os.svg", diff --git a/src/ui/browserAction/backend.js b/src/ui/browserAction/backend.js index 16fd14e3..384f8c0f 100644 --- a/src/ui/browserAction/backend.js +++ b/src/ui/browserAction/backend.js @@ -27,6 +27,9 @@ import { getExposedObject } from "../../shared/ipc.js"; export const vpnController = await getExposedObject("VPNController"); export const extController = await getExposedObject("ExtensionController"); export const proxyHandler = await getExposedObject("ProxyHandler"); +export const onboardingController = await getExposedObject( + "OnboardingController" +); export const butterBarService = await getExposedObject("ButterBarService"); /** diff --git a/src/ui/browserAction/popup.html b/src/ui/browserAction/popup.html index 1f7f5eb8..0cebbaec 100644 --- a/src/ui/browserAction/popup.html +++ b/src/ui/browserAction/popup.html @@ -35,7 +35,10 @@