Skip to content

Commit

Permalink
Add contries codes for GeoIP check
Browse files Browse the repository at this point in the history
  • Loading branch information
cooltey committed Aug 26, 2024
1 parent d860e93 commit 9e8702d
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
package org.wikipedia.analytics.metricsplatform

import org.wikipedia.util.GeoUtil
import org.wikipedia.util.ReleaseUtil

// TODO: integrate this with ArticleLinkPreviewInteraction
class RecommendedContentAnalyticsHelper {

companion object {
private const val RECOMMENDED_CONTENT = "recommendedContent"
val abcTest = RecommendedContentABCTest()

private val enableCountries = listOf(
// sub-saharan africa
"AO", "BJ", "BW", "IO", "BF", "BI", "CV", "CM", "CF", "TD", "KM", "CG", "IC", "CD", "DJ", "GQ", "ER",
"SZ", "ET", "GA", "GM", "GH", "GN", "GW", "KE", "LS", "LR", "MG", "MW", "ML", "MR", "MU", "YT", "MZ",
"NA", "NE", "NG", "RE", "RW", "SH", "ST", "SN", "SC", "SL", "SO", "ZA", "SS", "TG", "UG", "TZ", "ZM", "ZW",
// south asia
"IN", "PK", "BD", "LK", "MU", "MV", "NP", "BT", "AF"
)

fun recommendedContentEnabled(): Boolean {
return ReleaseUtil.isPreBetaRelease || enableCountries.contains(GeoUtil.geoIPCountry.orEmpty())
}
}
}

0 comments on commit 9e8702d

Please sign in to comment.