|
|
|
@ -9,8 +9,6 @@ import android.content.Intent
|
|
|
|
|
import androidx.core.content.getSystemService
|
|
|
|
|
import androidx.core.net.toUri
|
|
|
|
|
import mozilla.components.feature.addons.AddonManager
|
|
|
|
|
import mozilla.components.feature.addons.AddonsProvider
|
|
|
|
|
import mozilla.components.feature.addons.amo.AddonCollectionProvider
|
|
|
|
|
import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker
|
|
|
|
|
import mozilla.components.feature.addons.migration.SupportedAddonsChecker
|
|
|
|
|
import mozilla.components.feature.addons.update.AddonUpdater
|
|
|
|
@ -18,9 +16,9 @@ import mozilla.components.feature.addons.update.DefaultAddonUpdater
|
|
|
|
|
import mozilla.components.lib.publicsuffixlist.PublicSuffixList
|
|
|
|
|
import mozilla.components.support.migration.state.MigrationStore
|
|
|
|
|
import network.novak.fenix.components.PagedAddonCollectionProvider
|
|
|
|
|
import org.mozilla.fenix.BuildConfig
|
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
|
import org.mozilla.fenix.components.metrics.AppStartupTelemetry
|
|
|
|
|
import org.mozilla.fenix.ext.settings
|
|
|
|
|
import org.mozilla.fenix.utils.ClipboardHandler
|
|
|
|
|
import org.mozilla.fenix.utils.Mockable
|
|
|
|
|
import org.mozilla.fenix.utils.Settings
|
|
|
|
@ -73,19 +71,18 @@ class Components(private val context: Context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val addonCollectionProvider by lazy {
|
|
|
|
|
if (!BuildConfig.AMO_COLLECTION.isNullOrEmpty()) {
|
|
|
|
|
val addonsAccount = context.settings().customAddonsAccount
|
|
|
|
|
val addonsCollection = context.settings().customAddonsCollection
|
|
|
|
|
PagedAddonCollectionProvider(
|
|
|
|
|
context,
|
|
|
|
|
core.client,
|
|
|
|
|
collectionAccount = BuildConfig.AMO_ACCOUNT,
|
|
|
|
|
collectionName = BuildConfig.AMO_COLLECTION,
|
|
|
|
|
collectionAccount = addonsAccount,
|
|
|
|
|
collectionName = addonsCollection,
|
|
|
|
|
maxCacheAgeInMinutes = DAY_IN_MINUTES
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
PagedAddonCollectionProvider(context, core.client, maxCacheAgeInMinutes = DAY_IN_MINUTES)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val appStartupTelemetry by lazy { AppStartupTelemetry(analytics.metrics) }
|
|
|
|
|
|
|
|
|
|
@Suppress("MagicNumber")
|
|
|
|
@ -108,6 +105,15 @@ class Components(private val context: Context) {
|
|
|
|
|
AddonManager(core.store, core.engine, addonCollectionProvider, addonUpdater)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun updateAddonManager() {
|
|
|
|
|
addonCollectionProvider.deleteCacheFile(context)
|
|
|
|
|
|
|
|
|
|
val addonsAccount = context.settings().customAddonsAccount
|
|
|
|
|
val addonsCollection = context.settings().customAddonsCollection
|
|
|
|
|
addonCollectionProvider.setCollectionAccount(addonsAccount)
|
|
|
|
|
addonCollectionProvider.setCollectionName(addonsCollection)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val analytics by lazy { Analytics(context) }
|
|
|
|
|
val publicSuffixList by lazy { PublicSuffixList(context) }
|
|
|
|
|
val clipboardHandler by lazy { ClipboardHandler(context) }
|
|
|
|
|