Closed Bug 1760364 Opened 2 years ago Closed 2 years ago

add shouldShowFocusPromo or similar to BrowserUtils

Categories

(Firefox :: Messaging System, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
100 Branch
Iteration:
100.2 - March 21 - April 1
Tracking Status
firefox100 --- fixed

People

(Reporter: dmosedale, Assigned: dmosedale)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

We need something very very similar to shouldShowVPNPromo for Firefox focus, but with different default lists, because the countries where it's allowed are different (everywhere except china).

We should be able to share the vast majority of the code.

shouldShowVPNPromo checks for

  vpnPromoEnabled &&
  !avoidAdsCountries.has(homeRegion.toLowerCase()) &&
  !avoidAdsCountries.has(currentRegion.toLowerCase()) &&
  inSupportedRegion &&
  noActivePolicy

shouldShowFocusPromo needs all the checks except 'inSupportedRegion' https://searchfox.org/mozilla-central/source/toolkit/modules/BrowserUtils.jsm#317.

We should expose method shouldShowPromo(promoType) inside BrowserUtils that calls 'shouldShowVPNPromo' or 'shouldShowFocusPromo' based off promoType.

shouldShowPromo should be called from aboutPrivateBrowsing.js passing promoType value from config JSON (either using id or use new promoType property), replacing check shouldShowVPNPromo.

https://searchfox.org/mozilla-central/rev/7d379061bd56251df911728686c378c5820513d8/browser/components/newtab/lib/OnboardingMessageProvider.jsm#41

https://searchfox.org/mozilla-central/source/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js#237

Attachment #9269509 - Attachment is obsolete: true
Attachment #9269510 - Attachment description: WIP: Bug 1760364 - implement shouldShowFocusPromo → Bug 1760364 - implement shouldShowFocusPromo, r=Gijs,mviar
Attachment #9269510 - Attachment description: Bug 1760364 - implement shouldShowFocusPromo, r=Gijs,mviar → Bug 1760364 - implement shouldShowFocusPromo, r=Gijs,mviar,hectorz
Attachment #9269510 - Attachment description: Bug 1760364 - implement shouldShowFocusPromo, r=Gijs,mviar,hectorz → Bug 1760364 - implement shouldShowFocusPromo, r=Gijs,mviar
Pushed by dmosedale@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b4d616f9657a
implement shouldShowFocusPromo, r=Gijs,mviar

One code stanza was incorrectly deleted by my patch. I've put it back and will re-land. Sorry for the inconvenience.

Flags: needinfo?(dmosedale)
Pushed by dmosedale@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3e061741cd1c
implement shouldShowFocusPromo, r=Gijs,mviar
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
See Also: → 1857903
Blocks: 1857903
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: