mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Add blocked regions from global config for donations payments.
This commit is contained in:
@@ -103,6 +103,9 @@ public final class FeatureFlags {
|
||||
public static final String CREDIT_CARD_PAYMENTS = "android.credit.card.payments.1";
|
||||
private static final String PAYMENTS_REQUEST_ACTIVATE_FLOW = "android.payments.requestActivateFlow";
|
||||
private static final String KEEP_MUTED_CHATS_ARCHIVED = "android.keepMutedChatsArchived";
|
||||
public static final String GOOGLE_PAY_DISABLED_REGIONS = "global.donations.gpayDisabledRegions";
|
||||
public static final String CREDIT_CARD_DISABLED_REGIONS = "global.donations.ccDisabledRegions";
|
||||
public static final String PAYPAL_DISABLED_REGIONS = "global.donations.paypalDisabledRegions";
|
||||
|
||||
/**
|
||||
* We will only store remote values for flags in this set. If you want a flag to be controllable
|
||||
@@ -157,7 +160,10 @@ public final class FeatureFlags {
|
||||
SMS_EXPORT_MEGAPHONE_DELAY_DAYS,
|
||||
CREDIT_CARD_PAYMENTS,
|
||||
PAYMENTS_REQUEST_ACTIVATE_FLOW,
|
||||
KEEP_MUTED_CHATS_ARCHIVED
|
||||
KEEP_MUTED_CHATS_ARCHIVED,
|
||||
GOOGLE_PAY_DISABLED_REGIONS,
|
||||
CREDIT_CARD_DISABLED_REGIONS,
|
||||
PAYPAL_DISABLED_REGIONS
|
||||
);
|
||||
|
||||
@VisibleForTesting
|
||||
@@ -562,6 +568,27 @@ public final class FeatureFlags {
|
||||
return getBoolean(KEEP_MUTED_CHATS_ARCHIVED, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Serialized list of regions in which Google Pay is disabled for donations
|
||||
*/
|
||||
public static @NonNull String googlePayDisabledRegions() {
|
||||
return getString(GOOGLE_PAY_DISABLED_REGIONS, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Serialized list of regions in which credit cards are disabled for donations
|
||||
*/
|
||||
public static @NonNull String creditCardDisabledRegions() {
|
||||
return getString(CREDIT_CARD_DISABLED_REGIONS, "*");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Serialized list of regions in which PayPal is disabled for donations
|
||||
*/
|
||||
public static @NonNull String paypalDisabledRegions() {
|
||||
return getString(PAYPAL_DISABLED_REGIONS, "*");
|
||||
}
|
||||
|
||||
/** Only for rendering debug info. */
|
||||
public static synchronized @NonNull Map<String, Object> getMemoryValues() {
|
||||
return new TreeMap<>(REMOTE_VALUES);
|
||||
|
||||
@@ -48,6 +48,27 @@ public final class LocaleFeatureFlags {
|
||||
return isEnabled(releaseNoteUuid, countries);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether Google Pay is disabled in this region
|
||||
*/
|
||||
public static boolean isGooglePayDisabled() {
|
||||
return isEnabled(FeatureFlags.GOOGLE_PAY_DISABLED_REGIONS, FeatureFlags.googlePayDisabledRegions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether credit cards are disabled in this region
|
||||
*/
|
||||
public static boolean isCreditCardDisabled() {
|
||||
return isEnabled(FeatureFlags.CREDIT_CARD_DISABLED_REGIONS, FeatureFlags.googlePayDisabledRegions());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether PayPal is disabled in this region
|
||||
*/
|
||||
public static boolean isPayPalDisabled() {
|
||||
return isEnabled(FeatureFlags.PAYPAL_DISABLED_REGIONS, FeatureFlags.googlePayDisabledRegions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a comma-separated list of country codes colon-separated from how many buckets out of 1 million
|
||||
* should be enabled to see this megaphone in that country code. At the end of the list, an optional
|
||||
|
||||
Reference in New Issue
Block a user