Bug 1847706 - Slightly refactor the `AddonsProvider` and its default implementation (#3154)

* Bug 1847706 - Rename `AddonsProvider.getAvailableAddons()` to `AddonsProvider.getFeaturedAddons()`

* Bug 1847706 - Rename `AddonCollectionProvider` to `AMOAddonsProvider`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
fenix/118.0
William Durand 10 months ago committed by GitHub
parent 40859e7b7d
commit 19b28887d2

@ -131,7 +131,7 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management)
runIfFragmentIsAttached {
if (!shouldRefresh) {
adapter = AddonsManagerAdapter(
requireContext().components.addonCollectionProvider,
requireContext().components.addonsProvider,
managementView,
addons,
style = createAddonStyle(requireContext()),

@ -12,7 +12,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.core.app.NotificationManagerCompat
import com.google.android.play.core.review.ReviewManagerFactory
import mozilla.components.feature.addons.AddonManager
import mozilla.components.feature.addons.amo.AddonCollectionProvider
import mozilla.components.feature.addons.amo.AMOAddonsProvider
import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker
import mozilla.components.feature.addons.update.DefaultAddonUpdater
import mozilla.components.feature.autofill.AutofillConfiguration
@ -112,10 +112,10 @@ class Components(private val context: Context) {
)
}
val addonCollectionProvider by lazyMonitored {
val addonsProvider by lazyMonitored {
// Check if we have a customized (overridden) AMO collection (supported in Nightly & Beta)
if (FeatureFlags.customExtensionCollectionFeature && context.settings().amoCollectionOverrideConfigured()) {
AddonCollectionProvider(
AMOAddonsProvider(
context,
core.client,
collectionUser = context.settings().overrideAmoUser,
@ -126,7 +126,7 @@ class Components(private val context: Context) {
else if (!BuildConfig.AMO_COLLECTION_USER.isNullOrEmpty() &&
!BuildConfig.AMO_COLLECTION_NAME.isNullOrEmpty()
) {
AddonCollectionProvider(
AMOAddonsProvider(
context,
core.client,
serverURL = BuildConfig.AMO_SERVER_URL,
@ -137,7 +137,7 @@ class Components(private val context: Context) {
}
// Fall back to defaults
else {
AddonCollectionProvider(context, core.client, maxCacheAgeInMinutes = AMO_COLLECTION_MAX_CACHE_AGE)
AMOAddonsProvider(context, core.client, maxCacheAgeInMinutes = AMO_COLLECTION_MAX_CACHE_AGE)
}
}
@ -155,7 +155,7 @@ class Components(private val context: Context) {
}
val addonManager by lazyMonitored {
AddonManager(core.store, core.engine, addonCollectionProvider, addonUpdater)
AddonManager(core.store, core.engine, addonsProvider, addonUpdater)
}
val analytics by lazyMonitored { Analytics(context) }

@ -232,7 +232,7 @@ class WebExtensionPromptFeature(
private fun showPostInstallationDialog(addon: Addon) {
if (!isInstallationInProgress && !hasExistingAddonPostInstallationDialogFragment()) {
val addonCollectionProvider = context.components.addonCollectionProvider
val addonsProvider = context.components.addonsProvider
// Fragment may not be attached to the context anymore during onConfirmButtonClicked handling,
// but we still want to be able to process user selection of the 'allowInPrivateBrowsing' pref.
@ -243,7 +243,7 @@ class WebExtensionPromptFeature(
val dialog = AddonInstallationDialogFragment.newInstance(
addon = addon,
addonCollectionProvider = addonCollectionProvider,
addonsProvider = addonsProvider,
promptsStyling = AddonInstallationDialogFragment.PromptsStyling(
gravity = Gravity.BOTTOM,
shouldWidthMatchParent = true,

Loading…
Cancel
Save