Add locale based feature flags for iDEAL / SEPA donations.

This commit is contained in:
Alex Hart
2023-10-24 16:02:52 -03:00
committed by Cody Henthorne
parent dddd0e7b71
commit 162ca3e21e
3 changed files with 28 additions and 7 deletions

View File

@@ -119,6 +119,8 @@ public final class FeatureFlags {
public static final String CRASH_PROMPT_CONFIG = "android.crashPromptConfig";
private static final String SEPA_DEBIT_DONATIONS = "android.sepa.debit.donations";
private static final String IDEAL_DONATIONS = "android.ideal.donations";
public static final String IDEAL_ENABLED_REGIONS = "global.donations.idealEnabledRegions";
public static final String SEPA_ENABLED_REGIONS = "global.donations.sepaEnabledRegions";
/**
* We will only store remote values for flags in this set. If you want a flag to be controllable
@@ -189,7 +191,9 @@ public final class FeatureFlags {
CRASH_PROMPT_CONFIG,
BLOCK_SSE,
SEPA_DEBIT_DONATIONS,
IDEAL_DONATIONS
IDEAL_DONATIONS,
IDEAL_ENABLED_REGIONS,
SEPA_ENABLED_REGIONS
);
@VisibleForTesting
@@ -689,11 +693,19 @@ public final class FeatureFlags {
* WARNING: This feature is under heavy development and is *not* ready for wider use.
*/
public static boolean sepaDebitDonations() {
return getBoolean(SEPA_DEBIT_DONATIONS, Environment.IS_STAGING);
return getBoolean(SEPA_DEBIT_DONATIONS, false);
}
public static boolean idealDonations() {
return getBoolean(IDEAL_DONATIONS, Environment.IS_STAGING);
return getBoolean(IDEAL_DONATIONS, false);
}
public static String idealEnabledRegions() {
return getString(IDEAL_ENABLED_REGIONS, "");
}
public static String sepaEnabledRegions() {
return getString(SEPA_ENABLED_REGIONS, "");
}
/** Only for rendering debug info. */

View File

@@ -65,6 +65,14 @@ public final class LocaleFeatureFlags {
return isEnabled(FeatureFlags.PAYPAL_DISABLED_REGIONS, FeatureFlags.paypalDisabledRegions());
}
public static boolean isIdealEnabled() {
return isEnabled(FeatureFlags.IDEAL_ENABLED_REGIONS, FeatureFlags.idealEnabledRegions());
}
public static boolean isSepaEnabled() {
return isEnabled(FeatureFlags.SEPA_ENABLED_REGIONS, FeatureFlags.sepaEnabledRegions());
}
public static boolean isDelayedNotificationPromptEnabled() {
return FeatureFlags.internalUser() || isEnabled(FeatureFlags.PROMPT_FOR_NOTIFICATION_LOGS, FeatureFlags.promptForDelayedNotificationLogs());
}