Add device-specific support configs.

This commit is contained in:
Michelle Tang
2024-06-21 10:45:22 -07:00
committed by Greyson Parrelli
parent c0da0bd272
commit b806952430
10 changed files with 203 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ import com.google.i18n.phonenumbers.PhoneNumberUtil;
import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.mms.PushMediaConstraints;
import org.thoughtcrime.securesms.notifications.DelayedNotificationConfig;
import org.thoughtcrime.securesms.recipients.Recipient;
import java.util.Arrays;
@@ -74,7 +75,7 @@ public final class LocaleRemoteConfig {
}
public static boolean isBatterySaverPromptEnabled() {
return RemoteConfig.internalUser() || isEnabledPartsPerMillion(RemoteConfig.PROMPT_BATTERY_SAVER, RemoteConfig.promptBatterySaver());
return RemoteConfig.internalUser() || isEnabledPartsPerMillion(RemoteConfig.PROMPT_BATTERY_SAVER, DelayedNotificationConfig.INSTANCE.getCurrentConfig().getLocalePercent());
}
/**

View File

@@ -16,6 +16,9 @@ import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob
import org.thoughtcrime.securesms.jobs.Svr3MirrorJob
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.messageprocessingalarm.RoutineMessageFetchReceiver
import org.thoughtcrime.securesms.util.RemoteConfig.Config
import org.thoughtcrime.securesms.util.RemoteConfig.remoteBoolean
import org.thoughtcrime.securesms.util.RemoteConfig.remoteValue
import java.io.IOException
import java.util.TreeMap
import kotlin.math.max
@@ -873,6 +876,14 @@ object RemoteConfig {
hotSwappable = true
)
private const val PROMPT_DELAYED_NOTIFICATION_CONFIG: String = "android.delayedNotificationConfig"
val promptDelayedNotificationConfig: String by remoteString(
key = PROMPT_DELAYED_NOTIFICATION_CONFIG,
defaultValue = "",
hotSwappable = true
)
const val CRASH_PROMPT_CONFIG: String = "android.crashPromptConfig"
/** Config object for what crashes to prompt about. */