For #25352 - Add a new FML feature to gate Pocket sponsored stories

pull/543/head
Mugurell 2 years ago committed by mergify[bot]
parent e1c94881f4
commit 849d922038

@ -55,6 +55,14 @@ nimbus-validation:
settings-title: settings-title:
type: string type: string
description: The title of displayed in the Settings screen and app menu. description: The title of displayed in the Settings screen and app menu.
pocket-sponsored-stories:
description: A feature showing sponsored stories in between the other Pocket recommended stories on homescreen.
hasExposure: true
exposureDescription: ""
variables:
enabled:
type: boolean
description: "If true, the Pocket stories shown on homescreen should contain sponsored stories also."
search-term-groups: search-term-groups:
description: A feature allowing the grouping of URLs around the search term that it came from. description: A feature allowing the grouping of URLs around the search term that it came from.
hasExposure: true hasExposure: true

@ -295,7 +295,7 @@ open class HomeActivity : LocaleAwareAppCompatActivity(), NavHostActivity {
if (settings().showPocketRecommendationsFeature) { if (settings().showPocketRecommendationsFeature) {
components.core.pocketStoriesService.startPeriodicStoriesRefresh() components.core.pocketStoriesService.startPeriodicStoriesRefresh()
} }
if (FeatureFlags.isPocketSponsoredStoriesFeatureEnabled(this@HomeActivity)) { if (settings().showPocketSponsoredStories) {
components.core.pocketStoriesService.startPeriodicSponsoredStoriesRefresh() components.core.pocketStoriesService.startPeriodicSponsoredStoriesRefresh()
} }
} }

@ -229,7 +229,7 @@ class HomeFragment : Fragment() {
components.appStore.dispatch(AppAction.PocketStoriesCategoriesChange(categories)) components.appStore.dispatch(AppAction.PocketStoriesCategoriesChange(categories))
if (FeatureFlags.isPocketSponsoredStoriesFeatureEnabled(requireContext())) { if (requireContext().settings().showPocketSponsoredStories) {
components.appStore.dispatch( components.appStore.dispatch(
AppAction.PocketSponsoredStoriesChange( AppAction.PocketSponsoredStoriesChange(
components.core.pocketStoriesService.getSponsoredStories() components.core.pocketStoriesService.getSponsoredStories()

@ -1275,6 +1275,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
default = { homescreenSections[HomeScreenSection.POCKET] == true }, default = { homescreenSections[HomeScreenSection.POCKET] == true },
) )
/**
* Indicates if the Pocket recommendations homescreen section should also show sponsored stories.
*/
val showPocketSponsoredStories by lazyFeatureFlagPreference(
key = appContext.getPreferenceKey(R.string.pref_key_pocket_sponsored_stories),
default = { FxNimbus.features.pocketSponsoredStories.value(appContext).enabled },
featureFlag = FeatureFlags.isPocketSponsoredStoriesFeatureEnabled(appContext)
)
/** /**
* Get the profile id to use in the sponsored stories communications with the Pocket endpoint. * Get the profile id to use in the sponsored stories communications with the Pocket endpoint.
*/ */

@ -281,6 +281,7 @@
<!-- Pocket --> <!-- Pocket -->
<string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</string> <string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</string>
<string name="pref_key_pocket_sponsored_stories" translatable="false">pref_key_pocket_sponsored_stories</string>
<string name="pref_key_pocket_sponsored_stories_profile" translatable="false">pref_key_pocket_sponsored_stories_profile</string> <string name="pref_key_pocket_sponsored_stories_profile" translatable="false">pref_key_pocket_sponsored_stories_profile</string>
<!-- Secret Info Setting Keys --> <!-- Secret Info Setting Keys -->

@ -190,6 +190,18 @@ features:
value: value:
enabled: false enabled: false
pocket-sponsored-stories:
description: A feature showing sponsored stories in between the other Pocket recommended stories on homescreen.
variables:
enabled:
description: If true, the Pocket stories shown on homescreen should contain sponsored stories also.
type: Boolean
default: false
defaults:
- channel: developer
value:
enabled: true
types: types:
objects: objects:
MessageData: MessageData:

Loading…
Cancel
Save