2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

[#4089] Moved PublicSuffixList to a sub-component(Utilities) class.

This commit is contained in:
chiragmantri 2019-07-24 01:11:44 +05:30 committed by Jonathan Almeida
parent 9db0d88346
commit 945b1ee274
4 changed files with 5 additions and 3 deletions

View File

@ -75,7 +75,7 @@ open class HomeActivity : AppCompatActivity(), ShareFragment.TabsSharedCallback
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
components.publicSuffixList.prefetch()
components.utils.publicSuffixList.prefetch()
setupThemeAndBrowsingMode()
setContentView(R.layout.activity_home)

View File

@ -22,5 +22,4 @@ class Components(private val context: Context) {
val useCases by lazy { UseCases(context, core.sessionManager, core.engine.settings, search.searchEngineManager) }
val utils by lazy { Utilities(context, core.sessionManager, useCases.sessionUseCases, useCases.searchUseCases) }
val analytics by lazy { Analytics(context) }
val publicSuffixList by lazy { PublicSuffixList(context) }
}

View File

@ -10,6 +10,7 @@ import mozilla.components.feature.customtabs.CustomTabIntentProcessor
import mozilla.components.feature.intent.TabIntentProcessor
import mozilla.components.feature.search.SearchUseCases
import mozilla.components.feature.session.SessionUseCases
import mozilla.components.lib.publicsuffixlist.PublicSuffixList
import org.mozilla.fenix.test.Mockable
/**
@ -44,4 +45,6 @@ class Utilities(
val notificationManager by lazy {
NotificationManager(context)
}
val publicSuffixList by lazy { PublicSuffixList(context) }
}

View File

@ -37,7 +37,7 @@ fun String.urlToTrimmedHost(context: Context): String {
return try {
val host = toUri().hostWithoutCommonPrefixes ?: return this
runBlocking {
context.components.publicSuffixList.stripPublicSuffix(host).await()
context.components.utils.publicSuffixList.stripPublicSuffix(host).await()
}
} catch (e: MalformedURLException) {
this