parent
e86120027f
commit
ce4293c8c8
|
@ -336,6 +336,7 @@ open class FenixApplication : LocaleAwareApplication() {
|
|||
},
|
||||
onExtensionsLoaded = { extensions ->
|
||||
components.addonUpdater.registerForFutureUpdates(extensions)
|
||||
components.supportedAddChecker.registerForChecks()
|
||||
},
|
||||
onUpdatePermissionRequest = components.addonUpdater::onUpdatePermissionRequest
|
||||
)
|
||||
|
|
|
@ -33,5 +33,9 @@ enum class GlobalDirections(val navDirections: NavDirections, val destinationId:
|
|||
DeleteData(
|
||||
NavGraphDirections.actionGlobalDeleteBrowsingDataFragment(),
|
||||
R.id.deleteBrowsingDataFragment
|
||||
),
|
||||
SettingsAddonManager(
|
||||
NavGraphDirections.actionGlobalSettingsAddonsManagementFragment(),
|
||||
R.id.addonsManagementFragment
|
||||
)
|
||||
}
|
||||
|
|
|
@ -5,13 +5,18 @@
|
|||
package org.mozilla.fenix.components
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.core.net.toUri
|
||||
import mozilla.components.feature.addons.AddonManager
|
||||
import mozilla.components.feature.addons.amo.AddonCollectionProvider
|
||||
import mozilla.components.feature.addons.update.AddonUpdater
|
||||
import mozilla.components.feature.addons.update.DefaultAddonUpdater
|
||||
import mozilla.components.feature.addons.migration.SupportedAddonsChecker
|
||||
import mozilla.components.feature.addons.migration.DefaultSupportedAddonsChecker
|
||||
import mozilla.components.feature.tabs.TabsUseCases
|
||||
import mozilla.components.lib.publicsuffixlist.PublicSuffixList
|
||||
import mozilla.components.support.migration.state.MigrationStore
|
||||
import org.mozilla.fenix.HomeActivity
|
||||
import org.mozilla.fenix.test.Mockable
|
||||
import org.mozilla.fenix.utils.ClipboardHandler
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
@ -68,6 +73,17 @@ class Components(private val context: Context) {
|
|||
DefaultAddonUpdater(context, AddonUpdater.Frequency(12, TimeUnit.HOURS))
|
||||
}
|
||||
|
||||
@Suppress("MagicNumber")
|
||||
val supportedAddChecker by lazy {
|
||||
DefaultSupportedAddonsChecker(context, SupportedAddonsChecker.Frequency(16, TimeUnit.MINUTES),
|
||||
onNotificationClickIntent = Intent(context, HomeActivity::class.java).apply {
|
||||
action = Intent.ACTION_VIEW
|
||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
data = "fenix://settings_addon_manager".toUri()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
val addonManager by lazy {
|
||||
AddonManager(core.store, core.engine, addonCollectionProvider, addonUpdater)
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class DeepLinkIntentProcessor(
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("ComplexMethod")
|
||||
private fun handleDeepLink(deepLink: Uri, navController: NavController) {
|
||||
handleDeepLinkSideEffects(deepLink)
|
||||
|
||||
|
@ -42,6 +43,7 @@ class DeepLinkIntentProcessor(
|
|||
"settings_search_engine" -> GlobalDirections.SearchEngine
|
||||
"settings_accessibility" -> GlobalDirections.Accessibility
|
||||
"settings_delete_browsing_data" -> GlobalDirections.DeleteData
|
||||
"settings_addon_manager" -> GlobalDirections.SettingsAddonManager
|
||||
else -> return
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
android:id="@+id/action_global_settingsFragment"
|
||||
app:destination="@id/settingsFragment" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_settings_addonsManagementFragment"
|
||||
app:destination="@id/addonsManagementFragment" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_searchEngineFragment"
|
||||
app:destination="@id/searchEngineFragment" />
|
||||
|
|
|
@ -150,5 +150,13 @@ class DeepLinkIntentProcessorTest {
|
|||
verify { out wasNot Called }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `process settings_addon_manager deep link`() {
|
||||
assertTrue(processor.process(testIntent("fenix://settings_addon_manager"), navController, out))
|
||||
|
||||
verify { navController.navigate(NavGraphDirections.actionGlobalSettingsAddonsManagementFragment()) }
|
||||
verify { out wasNot Called }
|
||||
}
|
||||
|
||||
private fun testIntent(uri: String) = Intent("", uri.toUri())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue