mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-03 23:15:31 +00:00
[fenix] Bug 1811537 - Add secret setting allowing to overwrite the country
and city
parameters for Pocket sponsored stories
This commit is contained in:
parent
f072aa85cc
commit
ef8366dc01
@ -413,7 +413,11 @@ class Core(
|
||||
appId = BuildConfig.POCKET_CONSUMER_KEY,
|
||||
),
|
||||
sponsoredStoriesParams = if (context.settings().useCustomConfigurationForSponsoredStories) {
|
||||
PocketStoriesRequestConfig(context.settings().pocketSponsoredStoriesSiteId)
|
||||
PocketStoriesRequestConfig(
|
||||
context.settings().pocketSponsoredStoriesSiteId,
|
||||
context.settings().pocketSponsoredStoriesCountry,
|
||||
context.settings().pocketSponsoredStoriesCity,
|
||||
)
|
||||
} else {
|
||||
PocketStoriesRequestConfig()
|
||||
},
|
||||
|
@ -34,5 +34,21 @@ class SponsoredStoriesSettingsFragment : PreferenceFragmentCompat() {
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
requirePreference<EditTextPreference>(R.string.pref_key_custom_sponsored_stories_country).apply {
|
||||
isVisible = Config.channel.isNightlyOrDebug
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
context.settings().pocketSponsoredStoriesCountry = (newValue as String)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
requirePreference<EditTextPreference>(R.string.pref_key_custom_sponsored_stories_city).apply {
|
||||
isVisible = Config.channel.isNightlyOrDebug
|
||||
onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
|
||||
context.settings().pocketSponsoredStoriesCity = (newValue as String)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1472,6 +1472,22 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||
default = "",
|
||||
)
|
||||
|
||||
/**
|
||||
* Country parameter used to set the spoc content.
|
||||
*/
|
||||
var pocketSponsoredStoriesCountry by stringPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_custom_sponsored_stories_country),
|
||||
default = "",
|
||||
)
|
||||
|
||||
/**
|
||||
* City parameter used to set the spoc content.
|
||||
*/
|
||||
var pocketSponsoredStoriesCity by stringPreference(
|
||||
appContext.getPreferenceKey(R.string.pref_key_custom_sponsored_stories_city),
|
||||
default = "",
|
||||
)
|
||||
|
||||
/**
|
||||
* Indicates if the Contile functionality should be visible.
|
||||
*/
|
||||
|
@ -320,6 +320,8 @@
|
||||
<string name="pref_key_custom_sponsored_stories_parameters" translatable="false">pref_key_custom_sponsored_stories_parameters</string>
|
||||
<string name="pref_key_custom_sponsored_stories_parameters_enabled" translatable="false">pref_key_custom_sponsored_stories_parameters_enabled</string>
|
||||
<string name="pref_key_custom_sponsored_stories_site_id" translatable="false">pref_key_custom_sponsored_stories_site_id</string>
|
||||
<string name="pref_key_custom_sponsored_stories_country" translatable="false">pref_key_custom_sponsored_stories_country</string>
|
||||
<string name="pref_key_custom_sponsored_stories_city" translatable="false">pref_key_custom_sponsored_stories_city</string>
|
||||
|
||||
<!-- Growth Data -->
|
||||
<string name="pref_key_growth_set_as_default" translatable="false">pref_key_growth_set_as_default</string>
|
||||
|
@ -54,6 +54,10 @@
|
||||
<string name="preferences_debug_settings_custom_sponsored_stories_parameters_enabled" translatable="false">Enable custom Pocket sponsored stories parameters (requires restart)</string>
|
||||
<!-- Label for custom Pocket sponsored stories site id setting -->
|
||||
<string name="preferences_debug_settings_custom_sponsored_stories_parameters_site" translatable="false">Site parameter</string>
|
||||
<!-- Label for custom Pocket sponsored stories country parameter -->
|
||||
<string name="preferences_debug_settings_custom_sponsored_stories_country" translatable="false">Country parameter</string>
|
||||
<!-- Label for custom Pocket sponsored stories city parameter -->
|
||||
<string name="preferences_debug_settings_custom_sponsored_stories_city" translatable="false">City parameter</string>
|
||||
<!-- Title of preference for sync debugging (only shown in the when the secret debug menu is enabled) -->
|
||||
<string name="preferences_sync_debug">Sync Debug</string>
|
||||
<!-- Preference to override the Push server -->
|
||||
|
@ -15,4 +15,18 @@
|
||||
android:title="@string/preferences_debug_settings_custom_sponsored_stories_parameters_site"
|
||||
app:iconSpaceReserved="false"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<EditTextPreference
|
||||
android:dependency="@string/pref_key_custom_sponsored_stories_parameters_enabled"
|
||||
android:key="@string/pref_key_custom_sponsored_stories_country"
|
||||
android:title="@string/preferences_debug_settings_custom_sponsored_stories_country"
|
||||
android:inputType="text"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
app:iconSpaceReserved="false" />
|
||||
<EditTextPreference
|
||||
android:dependency="@string/pref_key_custom_sponsored_stories_parameters_enabled"
|
||||
android:key="@string/pref_key_custom_sponsored_stories_city"
|
||||
android:title="@string/preferences_debug_settings_custom_sponsored_stories_city"
|
||||
android:inputType="text"
|
||||
app:useSimpleSummaryProvider="true"
|
||||
app:iconSpaceReserved="false" />
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
Loading…
Reference in New Issue
Block a user