For #25311 - Set tokens used when communicating with Pocket
This commit is contained in:
parent
98e3b8bf52
commit
2343b7534c
|
@ -85,6 +85,7 @@ gen-external-apklibs
|
||||||
.mls_token
|
.mls_token
|
||||||
.nimbus
|
.nimbus
|
||||||
.wallpaper_url
|
.wallpaper_url
|
||||||
|
.pocket_consumer_key
|
||||||
|
|
||||||
# Python Byte-compiled / optimized / DLL files
|
# Python Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
|
@ -389,6 +389,21 @@ android.applicationVariants.all { variant ->
|
||||||
buildConfigField 'String', 'WALLPAPER_URL', '""'
|
buildConfigField 'String', 'WALLPAPER_URL', '""'
|
||||||
println("--")
|
println("--")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -------------------------------------------------------------------------------------------------
|
||||||
|
// BuildConfig: Set the Pocket consumer key from a local file if it exists
|
||||||
|
// -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
print("Pocket consumer key: ")
|
||||||
|
|
||||||
|
try {
|
||||||
|
def token = new File("${rootDir}/.pocket_consumer_key").text.trim()
|
||||||
|
buildConfigField 'String', 'POCKET_CONSUMER_KEY', '"' + token + '"'
|
||||||
|
println "(Added from .pocket_consumer_key file)"
|
||||||
|
} catch (FileNotFoundException ignored) {
|
||||||
|
buildConfigField 'String', 'POCKET_CONSUMER_KEY', '""'
|
||||||
|
println("--")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Kotlin code for the Fenix Glean metrics.
|
// Generate Kotlin code for the Fenix Glean metrics.
|
||||||
|
|
|
@ -365,8 +365,10 @@ class Core(
|
||||||
PocketStoriesConfig(
|
PocketStoriesConfig(
|
||||||
client,
|
client,
|
||||||
Frequency(4, TimeUnit.HOURS),
|
Frequency(4, TimeUnit.HOURS),
|
||||||
// These need to be updated. See https://mozilla-hub.atlassian.net/browse/FNXV2-20329.
|
Profile(
|
||||||
Profile(UUID.randomUUID(), "fenix")
|
profileId = UUID.fromString(context.settings().pocketSponsoredStoriesProfileId),
|
||||||
|
appId = BuildConfig.POCKET_CONSUMER_KEY
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val pocketStoriesService by lazyMonitored { PocketStoriesService(context, pocketStoriesConfig) }
|
val pocketStoriesService by lazyMonitored { PocketStoriesService(context, pocketStoriesConfig) }
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.mozilla.fenix.settings.sitepermissions.AUTOPLAY_BLOCK_ALL
|
||||||
import org.mozilla.fenix.settings.sitepermissions.AUTOPLAY_BLOCK_AUDIBLE
|
import org.mozilla.fenix.settings.sitepermissions.AUTOPLAY_BLOCK_AUDIBLE
|
||||||
import org.mozilla.fenix.wallpapers.WallpaperManager
|
import org.mozilla.fenix.wallpapers.WallpaperManager
|
||||||
import java.security.InvalidParameterException
|
import java.security.InvalidParameterException
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
private const val AUTOPLAY_USER_SETTING = "AUTOPLAY_USER_SETTING"
|
private const val AUTOPLAY_USER_SETTING = "AUTOPLAY_USER_SETTING"
|
||||||
|
|
||||||
|
@ -1274,6 +1275,15 @@ class Settings(private val appContext: Context) : PreferencesHolder {
|
||||||
default = { homescreenSections[HomeScreenSection.POCKET] == true },
|
default = { homescreenSections[HomeScreenSection.POCKET] == true },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the profile id to use in the sponsored stories communications with the Pocket endpoint.
|
||||||
|
*/
|
||||||
|
val pocketSponsoredStoriesProfileId by stringPreference(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_pocket_sponsored_stories_profile),
|
||||||
|
default = UUID.randomUUID().toString(),
|
||||||
|
persistDefaultIfNotExists = true
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates if the Contile functionality should be visible.
|
* Indicates if the Contile functionality should be visible.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -279,6 +279,10 @@
|
||||||
|
|
||||||
<string name="pref_key_open_next_tab_desktop_mode" translatable="false">pref_key_open_next_tab_desktop_mode</string>
|
<string name="pref_key_open_next_tab_desktop_mode" translatable="false">pref_key_open_next_tab_desktop_mode</string>
|
||||||
|
|
||||||
|
<!-- Pocket -->
|
||||||
|
<string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</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 -->
|
||||||
<string name="pref_key_secret_debug_info" translatable="false">pref_key_secret_debug_info</string>
|
<string name="pref_key_secret_debug_info" translatable="false">pref_key_secret_debug_info</string>
|
||||||
|
|
||||||
|
@ -287,6 +291,5 @@
|
||||||
<string name="pref_key_nimbus_experiments" translatable="false">pref_key_nimbus_experiments</string>
|
<string name="pref_key_nimbus_experiments" translatable="false">pref_key_nimbus_experiments</string>
|
||||||
<string name="pref_key_nimbus_use_preview" translatable="false">pref_key_nimbus_use_preview</string>
|
<string name="pref_key_nimbus_use_preview" translatable="false">pref_key_nimbus_use_preview</string>
|
||||||
<string name="pref_key_history_metadata_feature" translatable="false">pref_key_history_metadata_feature</string>
|
<string name="pref_key_history_metadata_feature" translatable="false">pref_key_history_metadata_feature</string>
|
||||||
<string name="pref_key_pocket_homescreen_recommendations" translatable="false">pref_key_pocket_homescreen_recommendations</string>
|
|
||||||
<string name="pref_key_show_unified_search" translatable="false">pref_key_show_unified_search</string>
|
<string name="pref_key_show_unified_search" translatable="false">pref_key_show_unified_search</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -55,6 +55,7 @@ def add_shippable_secrets(config, tasks):
|
||||||
("mls", ".mls_token"),
|
("mls", ".mls_token"),
|
||||||
("nimbus_url", ".nimbus"),
|
("nimbus_url", ".nimbus"),
|
||||||
("wallpaper_url", ".wallpaper_url"),
|
("wallpaper_url", ".wallpaper_url"),
|
||||||
|
("pocket_consumer_key", ".pocket_consumer_key"),
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue