diff --git a/app/build.gradle b/app/build.gradle index a4a1f92f58..9fc6460bf8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -171,7 +171,7 @@ android { buildConfigField "String[]", "LANGUAGES", "new String[]{\"" + autoResConfig().collect { s -> s.replace('-r', '_') }.join('", "') + '"}' buildConfigField "int", "CANONICAL_VERSION_CODE", "$canonicalVersionCode" buildConfigField "String", "DEFAULT_CURRENCIES", "\"EUR,AUD,GBP,CAD,CNY\"" - buildConfigField "int[]", "MOBILE_COIN_REGIONS", "new int[]{44,49,33,41}" + buildConfigField "int[]", "MOBILE_COIN_BLACKLIST", "new int[]{98,963,53,850,380}" buildConfigField "String", "GIPHY_API_KEY", "\"3o6ZsYH6U6Eri53TXy\"" buildConfigField "String", "RECAPTCHA_PROOF_URL", "\"https://signalcaptchas.org/challenge/generate.html\"" diff --git a/app/src/main/java/org/thoughtcrime/securesms/payments/GeographicalRestrictions.java b/app/src/main/java/org/thoughtcrime/securesms/payments/GeographicalRestrictions.java index ee5f5c1baa..6708c206ab 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/payments/GeographicalRestrictions.java +++ b/app/src/main/java/org/thoughtcrime/securesms/payments/GeographicalRestrictions.java @@ -18,20 +18,20 @@ public final class GeographicalRestrictions { private GeographicalRestrictions() {} - private static final Set REGION_CODE_SET; + private static final Set BLACKLIST; static { - Set set = new HashSet<>(BuildConfig.MOBILE_COIN_REGIONS.length); + Set set = new HashSet<>(BuildConfig.MOBILE_COIN_BLACKLIST.length); - for (int i = 0; i < BuildConfig.MOBILE_COIN_REGIONS.length; i++) { - set.add(BuildConfig.MOBILE_COIN_REGIONS[i]); + for (int i = 0; i < BuildConfig.MOBILE_COIN_BLACKLIST.length; i++) { + set.add(BuildConfig.MOBILE_COIN_BLACKLIST[i]); } - REGION_CODE_SET = Collections.unmodifiableSet(set); + BLACKLIST = Collections.unmodifiableSet(set); } public static boolean regionAllowed(int regionCode) { - return REGION_CODE_SET.contains(regionCode); + return !BLACKLIST.contains(regionCode); } public static boolean e164Allowed(@Nullable String e164) { diff --git a/app/src/test/java/org/thoughtcrime/securesms/payments/GeographicalRestrictionsTest.java b/app/src/test/java/org/thoughtcrime/securesms/payments/GeographicalRestrictionsTest.java index 9332c04859..866c759adb 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/payments/GeographicalRestrictionsTest.java +++ b/app/src/test/java/org/thoughtcrime/securesms/payments/GeographicalRestrictionsTest.java @@ -34,8 +34,9 @@ public final class GeographicalRestrictionsTest { } @Test - public void us_not_allowed_in_release() { - assumeFalse(BuildConfig.DEBUG); - assertFalse(GeographicalRestrictions.e164Allowed("+15407011234")); + public void blacklist_not_allowed() { + for (int code : BuildConfig.MOBILE_COIN_BLACKLIST) { + assertFalse(GeographicalRestrictions.regionAllowed(code)); + } } }