Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class DuckDuckGoAdClickManager @Inject constructor(
private val adClickCollector: AdClickCollector,
) : AdClickManager {

private val publicSuffixDatabase = PublicSuffixDatabase()

override fun detectAdClick(url: String?, isMainFrame: Boolean) {
if (url == null) return
if (!isMainFrame) return
Expand Down Expand Up @@ -132,7 +130,7 @@ class DuckDuckGoAdClickManager @Inject constructor(
private fun toTldPlusOne(url: String): String? {
val urlAdDomain = UriString.host(url)
if (urlAdDomain.isNullOrEmpty()) return urlAdDomain
return kotlin.runCatching { publicSuffixDatabase.getEffectiveTldPlusOne(urlAdDomain) }.getOrNull()
return kotlin.runCatching { PublicSuffixDatabase.get().getEffectiveTldPlusOne(urlAdDomain) }.getOrNull()
}

private fun adClicked(detectedAdDomain: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ private fun htmlDrawable(
private const val HTTPS_PREFIX = "https://"
private const val WWW_PREFIX = "www."
private const val WWW_SUFFIX = "/"
private val publicSuffixDatabase = PublicSuffixDatabase()

fun String.websiteFromGeoLocationsApiOrigin(): String {
val uri = Uri.parse(this)
Expand All @@ -60,7 +59,7 @@ fun String.asLocationPermissionOrigin(): String {
}

fun String.toTldPlusOne(): String? {
return runCatching { publicSuffixDatabase.getEffectiveTldPlusOne(this) }.getOrNull()
return runCatching { PublicSuffixDatabase.get().getEffectiveTldPlusOne(this) }.getOrNull()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ interface RequestDataViewStateMapper {
@ContributesBinding(AppScope::class)
class AppSiteRequestDataViewStateMapper @Inject constructor() : RequestDataViewStateMapper {

private val publicSuffixDatabase = PublicSuffixDatabase()
private val allowedCategories = listOf(
"Analytics",
"Advertising",
Expand Down Expand Up @@ -123,6 +122,6 @@ class AppSiteRequestDataViewStateMapper @Inject constructor() : RequestDataViewS
private fun toTldPlusOne(url: String): String? {
val urlAdDomain = UriString.host(url)
if (urlAdDomain.isNullOrEmpty()) return urlAdDomain
return kotlin.runCatching { publicSuffixDatabase.getEffectiveTldPlusOne(urlAdDomain) }.getOrNull()
return kotlin.runCatching { PublicSuffixDatabase.get().getEffectiveTldPlusOne(urlAdDomain) }.getOrNull()
}
}
Loading