Rename FeatureFlags -> RemoteConfig.

This commit is contained in:
Greyson Parrelli
2024-06-12 14:58:39 -04:00
parent ecbea9fd95
commit d698f74d0b
136 changed files with 460 additions and 478 deletions

View File

@@ -310,7 +310,7 @@ public class CommunicationActions {
return;
}
if (!FeatureFlags.adHocCalling()) {
if (!RemoteConfig.adHocCalling()) {
Toast.makeText(activity, R.string.CommunicationActions_cant_join_call, Toast.LENGTH_SHORT).show();
return;
}
@@ -340,7 +340,7 @@ public class CommunicationActions {
}
private static void startVideoCall(@NonNull CallContext callContext, @NonNull CallLinkRootKey rootKey) {
if (!FeatureFlags.adHocCalling()) {
if (!RemoteConfig.adHocCalling()) {
Toast.makeText(callContext.getContext(), R.string.CommunicationActions_cant_join_call, Toast.LENGTH_SHORT).show();
return;
}

View File

@@ -109,7 +109,7 @@ object DeleteDialog {
}
}
if (FeatureFlags.deleteSyncEnabled) {
if (RemoteConfig.deleteSyncEnabled) {
MultiDeviceDeleteSendSyncJob.enqueueMessageDeletes(messageRecords)
}

View File

@@ -30,11 +30,11 @@ public final class DeviceProperties {
return false;
}
if (memoryMb < FeatureFlags.animatedStickerMinimumTotalMemoryMb()) {
if (memoryMb < RemoteConfig.animatedStickerMinimumTotalMemoryMb()) {
return false;
}
if (getMemoryClass(context) < FeatureFlags.animatedStickerMinimumMemoryClass()) {
if (getMemoryClass(context) < RemoteConfig.animatedStickerMinimumMemoryClass()) {
return false;
}

View File

@@ -18,19 +18,19 @@ import java.util.Optional;
import java.util.stream.Collectors;
/**
* Provide access to locale specific values within feature flags following the locale CSV-Colon format.
* Provide access to locale-specific values within remote config, following the locale CSV-Colon format.
*
* Example: countryCode:integerValue,countryCode:integerValue,*:integerValue
*/
public final class LocaleFeatureFlags {
public final class LocaleRemoteConfig {
private static final String TAG = Log.tag(LocaleFeatureFlags.class);
private static final String TAG = Log.tag(LocaleRemoteConfig.class);
private static final String COUNTRY_WILDCARD = "*";
private static final int NOT_FOUND = -1;
public static @NonNull Optional<PushMediaConstraints.MediaConfig> getMediaQualityLevel() {
Map<String, Integer> countryValues = parseCountryValues(FeatureFlags.getMediaQualityLevels(), NOT_FOUND);
Map<String, Integer> countryValues = parseCountryValues(RemoteConfig.getMediaQualityLevels(), NOT_FOUND);
int level = getCountryValue(countryValues, Recipient.self().getE164().orElse(""), NOT_FOUND);
return Optional.ofNullable(PushMediaConstraints.MediaConfig.forLevel(level));
@@ -44,37 +44,37 @@ public final class LocaleFeatureFlags {
* @return Whether Google Pay is disabled in this region
*/
public static boolean isGooglePayDisabled() {
return isEnabledE164Start(FeatureFlags.googlePayDisabledRegions());
return isEnabledE164Start(RemoteConfig.googlePayDisabledRegions());
}
/**
* @return Whether credit cards are disabled in this region
*/
public static boolean isCreditCardDisabled() {
return isEnabledE164Start(FeatureFlags.creditCardDisabledRegions());
return isEnabledE164Start(RemoteConfig.creditCardDisabledRegions());
}
/**
* @return Whether PayPal is disabled in this region
*/
public static boolean isPayPalDisabled() {
return isEnabledE164Start(FeatureFlags.paypalDisabledRegions());
return isEnabledE164Start(RemoteConfig.paypalDisabledRegions());
}
public static boolean isIdealEnabled() {
return isEnabledE164Start(FeatureFlags.idealEnabledRegions());
return isEnabledE164Start(RemoteConfig.idealEnabledRegions());
}
public static boolean isSepaEnabled() {
return isEnabledE164Start(FeatureFlags.sepaEnabledRegions());
return isEnabledE164Start(RemoteConfig.sepaEnabledRegions());
}
public static boolean isDelayedNotificationPromptEnabled() {
return FeatureFlags.internalUser() || isEnabledPartsPerMillion(FeatureFlags.PROMPT_FOR_NOTIFICATION_LOGS, FeatureFlags.promptForDelayedNotificationLogs());
return RemoteConfig.internalUser() || isEnabledPartsPerMillion(RemoteConfig.PROMPT_FOR_NOTIFICATION_LOGS, RemoteConfig.promptForDelayedNotificationLogs());
}
public static boolean isBatterySaverPromptEnabled() {
return FeatureFlags.internalUser() || isEnabledPartsPerMillion(FeatureFlags.PROMPT_BATTERY_SAVER, FeatureFlags.promptBatterySaver());
return RemoteConfig.internalUser() || isEnabledPartsPerMillion(RemoteConfig.PROMPT_BATTERY_SAVER, RemoteConfig.promptBatterySaver());
}
/**

View File

@@ -25,16 +25,15 @@ import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds
/**
* A location for flags that can be set locally and remotely. These flags can guard features that
* are not yet ready to be activated.
* A location for accessing remotely-configured values.
*
* When creating a new flag:
* When creating a new config:
* - At the bottom of the file, create a new `val` with the name you'd like.
* - Use one of the helper delegates, like [remoteBoolean] or [remoteValue], to define your `val`.
* - See the documentation for [Config] understand all of the fields.
* - See the documentation for [Config] to understand all of the fields.
*/
object FeatureFlags {
private val TAG = Log.tag(FeatureFlags::class.java)
object RemoteConfig {
private val TAG = Log.tag(RemoteConfig::class.java)
// region Core behavior
@@ -851,7 +850,7 @@ object FeatureFlags {
@JvmStatic
@get:JvmName("promptForDelayedNotificationLogs")
val promptForDelayedNotificationLogs: String by remoteString(
key = FeatureFlags.PROMPT_FOR_NOTIFICATION_LOGS,
key = RemoteConfig.PROMPT_FOR_NOTIFICATION_LOGS,
defaultValue = "*",
hotSwappable = true
)

View File

@@ -24,7 +24,7 @@ public final class RemoteDeprecation {
* there's no pending expiration.
*/
public static long getTimeUntilDeprecation(long currentTime) {
return getTimeUntilDeprecation(FeatureFlags.clientExpiration(), currentTime, BuildConfig.VERSION_NAME);
return getTimeUntilDeprecation(RemoteConfig.clientExpiration(), currentTime, BuildConfig.VERSION_NAME);
}
/**