Refactor FeatureFlags.

This commit is contained in:
Greyson Parrelli
2024-06-12 13:57:07 -04:00
parent 39cb1c638e
commit 13f7a64139
76 changed files with 1059 additions and 1053 deletions

View File

@@ -20,7 +20,7 @@ import org.whispersystems.signalservice.api.kbs.PinHashUtil.verifyLocalPinHash
class MessageBackupsFlowViewModel : ViewModel() {
private val internalState = mutableStateOf(
MessageBackupsFlowState(
availableBackupTiers = if (!FeatureFlags.messageBackups()) {
availableBackupTiers = if (!FeatureFlags.messageBackups) {
emptyList()
} else {
listOf(MessageBackupTier.FREE, MessageBackupTier.PAID)

View File

@@ -54,7 +54,7 @@ object CallLinks {
@JvmStatic
fun isCallLink(url: String): Boolean {
if (!FeatureFlags.adHocCalling()) {
if (!FeatureFlags.adHocCalling) {
return false
}
@@ -67,7 +67,7 @@ object CallLinks {
@JvmStatic
fun parseUrl(url: String): CallLinkRootKey? {
if (!FeatureFlags.adHocCalling()) {
if (!FeatureFlags.adHocCalling) {
return null
}

View File

@@ -253,7 +253,7 @@ class CallLogFragment : Fragment(R.layout.call_log_fragment), CallLogAdapter.Cal
MaterialAlertDialogBuilder(requireContext())
.setTitle(resources.getQuantityString(R.plurals.CallLogFragment__delete_d_calls, count, count))
.setMessage(
if (FeatureFlags.adHocCalling()) {
if (FeatureFlags.adHocCalling) {
getString(R.string.CallLogFragment__call_links_youve_created)
} else {
null
@@ -403,7 +403,7 @@ class CallLogFragment : Fragment(R.layout.call_log_fragment), CallLogAdapter.Cal
MaterialAlertDialogBuilder(requireContext())
.setTitle(resources.getQuantityString(R.plurals.CallLogFragment__delete_d_calls, 1, 1))
.setMessage(
if (FeatureFlags.adHocCalling()) {
if (FeatureFlags.adHocCalling) {
getString(R.string.CallLogFragment__call_links_youve_created)
} else {
null

View File

@@ -10,7 +10,7 @@ class CallLogPagedDataSource(
) : PagedDataSource<CallLogRow.Id, CallLogRow> {
private val hasFilter = filter == CallLogFilter.MISSED
private val hasCallLinkRow = FeatureFlags.adHocCalling() && filter == CallLogFilter.ALL && query.isNullOrEmpty()
private val hasCallLinkRow = FeatureFlags.adHocCalling && filter == CallLogFilter.ALL && query.isNullOrEmpty()
private var callEventsCount = 0
private var callLinksCount = 0

View File

@@ -82,7 +82,7 @@ class CallLogViewModel(
controller.onDataInvalidated()
}
if (FeatureFlags.adHocCalling()) {
if (FeatureFlags.adHocCalling) {
disposables += Observable
.interval(30, TimeUnit.SECONDS, Schedulers.computation())
.flatMapCompletable { callLogRepository.peekCallLinks() }

View File

@@ -48,7 +48,7 @@ class DeleteSyncEducationDialog : ComposeBottomSheetDialogFragment() {
fun shouldShow(): Boolean {
return TextSecurePreferences.isMultiDevice(AppDependencies.application) &&
!SignalStore.uiHints().hasSeenDeleteSyncEducationSheet &&
FeatureFlags.deleteSyncEnabled()
FeatureFlags.deleteSyncEnabled
}
@JvmStatic

View File

@@ -40,7 +40,7 @@ class AppSettingsActivity : DSLSettingsActivity(), DonationPaymentComponent {
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
if (intent?.hasExtra(ARG_NAV_GRAPH) != true) {
val navGraphResId = if (FeatureFlags.registrationV2()) R.navigation.app_settings_with_change_number_v2 else R.navigation.app_settings
val navGraphResId = if (FeatureFlags.registrationV2) R.navigation.app_settings_with_change_number_v2 else R.navigation.app_settings
intent?.putExtra(ARG_NAV_GRAPH, navGraphResId)
}
@@ -197,7 +197,7 @@ class AppSettingsActivity : DSLSettingsActivity(), DonationPaymentComponent {
fun usernameRecovery(context: Context): Intent = getIntentForStartLocation(context, StartLocation.RECOVER_USERNAME)
private fun getIntentForStartLocation(context: Context, startLocation: StartLocation): Intent {
val navGraphResId = if (FeatureFlags.registrationV2()) R.navigation.app_settings_with_change_number_v2 else R.navigation.app_settings
val navGraphResId = if (FeatureFlags.registrationV2) R.navigation.app_settings_with_change_number_v2 else R.navigation.app_settings
return Intent(context, AppSettingsActivity::class.java)
.putExtra(ARG_NAV_GRAPH, navGraphResId)
.putExtra(START_LOCATION, startLocation.code)

View File

@@ -160,7 +160,7 @@ class AppSettingsFragment : DSLSettingsFragment(
title = DSLSettingsText.from(R.string.preferences__linked_devices),
icon = DSLSettingsIcon.from(R.drawable.symbol_devices_24),
onClick = {
if (FeatureFlags.internalUser()) {
if (FeatureFlags.internalUser) {
findNavController().safeNavigate(R.id.action_appSettingsFragment_to_linkDeviceFragment)
} else {
findNavController().safeNavigate(R.id.action_appSettingsFragment_to_deviceActivity)
@@ -281,7 +281,7 @@ class AppSettingsFragment : DSLSettingsFragment(
}
)
if (FeatureFlags.internalUser()) {
if (FeatureFlags.internalUser) {
dividerPref()
clickPref(

View File

@@ -84,7 +84,7 @@ class ChatsSettingsFragment : DSLSettingsFragment(R.string.preferences_chats__ch
sectionHeaderPref(R.string.preferences_chats__backups)
if (FeatureFlags.messageBackups() || state.remoteBackupsEnabled) {
if (FeatureFlags.messageBackups || state.remoteBackupsEnabled) {
clickPref(
title = DSLSettingsText.from("Signal Backups"), // TODO [message-backups] -- Finalized copy
summary = DSLSettingsText.from(if (state.remoteBackupsEnabled) R.string.arrays__enabled else R.string.arrays__disabled),

View File

@@ -138,7 +138,7 @@ class ManageStorageSettingsFragment : ComposeFragment() {
dialog("confirm-delete-chat-history") {
Dialogs.SimpleAlertDialog(
title = stringResource(id = R.string.preferences_storage__delete_message_history),
body = if (TextSecurePreferences.isMultiDevice(LocalContext.current) && FeatureFlags.deleteSyncEnabled()) {
body = if (TextSecurePreferences.isMultiDevice(LocalContext.current) && FeatureFlags.deleteSyncEnabled) {
stringResource(id = R.string.preferences_storage__this_will_delete_all_message_history_and_media_from_your_device_linked_device)
} else {
stringResource(id = R.string.preferences_storage__this_will_delete_all_message_history_and_media_from_your_device)
@@ -154,7 +154,7 @@ class ManageStorageSettingsFragment : ComposeFragment() {
dialog("double-confirm-delete-chat-history", dialogProperties = DialogProperties(dismissOnBackPress = true, dismissOnClickOutside = true)) {
Dialogs.SimpleAlertDialog(
title = stringResource(id = R.string.preferences_storage__are_you_sure_you_want_to_delete_all_message_history),
body = if (TextSecurePreferences.isMultiDevice(LocalContext.current) && FeatureFlags.deleteSyncEnabled()) {
body = if (TextSecurePreferences.isMultiDevice(LocalContext.current) && FeatureFlags.deleteSyncEnabled) {
stringResource(id = R.string.preferences_storage__all_message_history_will_be_permanently_removed_this_action_cannot_be_undone_linked_device)
} else {
stringResource(id = R.string.preferences_storage__all_message_history_will_be_permanently_removed_this_action_cannot_be_undone)

View File

@@ -38,9 +38,9 @@ object InAppDonations {
private fun isPayPalAvailableForDonateToSignalType(inAppPaymentType: InAppPaymentTable.Type): Boolean {
return when (inAppPaymentType) {
InAppPaymentTable.Type.UNKNOWN -> error("Unsupported type UNKNOWN")
InAppPaymentTable.Type.ONE_TIME_DONATION, InAppPaymentTable.Type.ONE_TIME_GIFT -> FeatureFlags.paypalOneTimeDonations()
InAppPaymentTable.Type.RECURRING_DONATION -> FeatureFlags.paypalRecurringDonations()
InAppPaymentTable.Type.RECURRING_BACKUP -> FeatureFlags.messageBackups() && FeatureFlags.paypalRecurringDonations()
InAppPaymentTable.Type.ONE_TIME_DONATION, InAppPaymentTable.Type.ONE_TIME_GIFT -> FeatureFlags.paypalOneTimeDonations
InAppPaymentTable.Type.RECURRING_DONATION -> FeatureFlags.paypalRecurringDonations
InAppPaymentTable.Type.RECURRING_BACKUP -> FeatureFlags.messageBackups && FeatureFlags.paypalRecurringDonations
} && !LocaleFeatureFlags.isPayPalDisabled()
}
@@ -55,7 +55,7 @@ object InAppDonations {
* Whether the user is in a region that supports PayPal, based off local phone number.
*/
fun isPayPalAvailable(): Boolean {
return (FeatureFlags.paypalOneTimeDonations() || FeatureFlags.paypalRecurringDonations()) && !LocaleFeatureFlags.isPayPalDisabled()
return (FeatureFlags.paypalOneTimeDonations || FeatureFlags.paypalRecurringDonations) && !LocaleFeatureFlags.isPayPalDisabled()
}
/**
@@ -69,14 +69,14 @@ object InAppDonations {
* Whether the user is in a region which supports SEPA Debit transfers, based off local phone number.
*/
fun isSEPADebitAvailable(): Boolean {
return Environment.IS_STAGING || (FeatureFlags.sepaDebitDonations() && LocaleFeatureFlags.isSepaEnabled())
return Environment.IS_STAGING || (FeatureFlags.sepaDebitDonations && LocaleFeatureFlags.isSepaEnabled())
}
/**
* Whether the user is in a region which supports IDEAL transfers, based off local phone number.
*/
fun isIDEALAvailable(): Boolean {
return Environment.IS_STAGING || (FeatureFlags.idealDonations() && LocaleFeatureFlags.isIdealEnabled())
return Environment.IS_STAGING || (FeatureFlags.idealDonations && LocaleFeatureFlags.isIdealEnabled())
}
/**

View File

@@ -84,7 +84,7 @@ class Stripe3DSDialogFragment : DialogFragment(R.layout.donation_webview_fragmen
)
)
if (FeatureFlags.internalUser() && args.inAppPayment.data.paymentMethodType == InAppPaymentData.PaymentMethodType.IDEAL) {
if (FeatureFlags.internalUser && args.inAppPayment.data.paymentMethodType == InAppPaymentData.PaymentMethodType.IDEAL) {
val openApp = MaterialButton(requireContext()).apply {
text = "Open App"
layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT).apply {

View File

@@ -159,9 +159,9 @@ class ConversationSettingsRepository(
members.addAll(groupRecord.members)
members.addAll(pendingMembers)
GroupCapacityResult(Recipient.self().id, members, FeatureFlags.groupLimits(), groupRecord.isAnnouncementGroup)
GroupCapacityResult(Recipient.self().id, members, FeatureFlags.groupLimits, groupRecord.isAnnouncementGroup)
} else {
GroupCapacityResult(Recipient.self().id, groupRecord.members, FeatureFlags.groupLimits(), false)
GroupCapacityResult(Recipient.self().id, groupRecord.members, FeatureFlags.groupLimits, false)
}
)
}

View File

@@ -98,7 +98,7 @@ object ContactDiscoveryRefreshV2 {
Optional.empty(),
BuildConfig.CDSI_MRENCLAVE,
10_000,
if (FeatureFlags.useLibsignalNetForCdsiLookup()) AppDependencies.libsignalNetwork else null
if (FeatureFlags.useLibsignalNetForCdsiLookup) AppDependencies.libsignalNetwork else null
) {
Log.i(TAG, "Ignoring token for one-off lookup.")
}
@@ -145,8 +145,8 @@ object ContactDiscoveryRefreshV2 {
return ContactDiscovery.RefreshResult(emptySet(), emptyMap())
}
if (newE164s.size > FeatureFlags.cdsHardLimit()) {
Log.w(TAG, "[$tag] Number of new contacts (${newE164s.size.roundedString()} > hard limit (${FeatureFlags.cdsHardLimit()}! Failing and marking ourselves as permanently blocked.")
if (newE164s.size > FeatureFlags.cdsHardLimit) {
Log.w(TAG, "[$tag] Number of new contacts (${newE164s.size.roundedString()} > hard limit (${FeatureFlags.cdsHardLimit}! Failing and marking ourselves as permanently blocked.")
SignalStore.misc().markCdsPermanentlyBlocked()
throw IOException("New contacts over the CDS hard limit!")
}
@@ -163,7 +163,7 @@ object ContactDiscoveryRefreshV2 {
Optional.ofNullable(token),
BuildConfig.CDSI_MRENCLAVE,
timeoutMs,
if (FeatureFlags.useLibsignalNetForCdsiLookup()) AppDependencies.libsignalNetwork else null
if (FeatureFlags.useLibsignalNetForCdsiLookup) AppDependencies.libsignalNetwork else null
) { tokenToSave ->
stopwatch.split("network-pre-token")
if (!isPartialRefresh) {

View File

@@ -124,7 +124,7 @@ class MultiselectForwardFragment :
contactSearchMediator = ContactSearchMediator(
this,
emptySet(),
FeatureFlags.shareSelectionLimit(),
FeatureFlags.shareSelectionLimit,
ContactSearchAdapter.DisplayOptions(
displayCheckBox = !args.selectSingleRecipient,
displaySecondaryInformation = ContactSearchAdapter.DisplaySecondaryInformation.NEVER,

View File

@@ -1687,7 +1687,7 @@ class ConversationFragment :
val keyboardPage = when (keyboardMode) {
TextSecurePreferences.MediaKeyboardMode.EMOJI -> if (isSystemEmojiPreferred) KeyboardPage.STICKER else KeyboardPage.EMOJI
TextSecurePreferences.MediaKeyboardMode.STICKER -> KeyboardPage.STICKER
TextSecurePreferences.MediaKeyboardMode.GIF -> if (FeatureFlags.gifSearchAvailable()) KeyboardPage.GIF else KeyboardPage.STICKER
TextSecurePreferences.MediaKeyboardMode.GIF -> if (FeatureFlags.gifSearchAvailable) KeyboardPage.GIF else KeyboardPage.STICKER
}
inputPanel.setMediaKeyboardToggleMode(keyboardPage)
@@ -2408,7 +2408,7 @@ class ConversationFragment :
disposables += DeleteDialog.show(
context = requireContext(),
messageRecords = records,
message = if (TextSecurePreferences.isMultiDevice(requireContext()) && FeatureFlags.deleteSyncEnabled()) {
message = if (TextSecurePreferences.isMultiDevice(requireContext()) && FeatureFlags.deleteSyncEnabled) {
resources.getQuantityString(R.plurals.ConversationFragment_delete_on_linked_warning, records.size)
} else {
null

View File

@@ -125,7 +125,7 @@ class ConversationDataSource(
records = MessageDataFetcher.updateModelsWithData(records, extraData).toMutableList()
stopwatch.split("models")
if (FeatureFlags.messageBackups() && SignalStore.backup().restoreState.inProgress) {
if (FeatureFlags.messageBackups && SignalStore.backup().restoreState.inProgress) {
BackupRestoreManager.prioritizeAttachmentsIfNeeded(records)
stopwatch.split("restore")
}

View File

@@ -28,7 +28,7 @@ object CrashConfig {
fun computePatterns(): List<CrashPattern> {
val aci: ServiceId.ACI = SignalStore.account().aci ?: return emptyList()
val serialized = FeatureFlags.crashPromptConfig()
val serialized = FeatureFlags.crashPromptConfig
if (serialized.isNullOrBlank()) {
return emptyList()
}

View File

@@ -164,7 +164,7 @@ class MediaTable internal constructor(context: Context?, databaseHelper: SignalD
@JvmOverloads
fun getGalleryMediaForThread(threadId: Long, sorting: Sorting, limit: Int = 0): Cursor {
var query = if (FeatureFlags.messageBackups()) {
var query = if (FeatureFlags.messageBackups) {
sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY_INCLUDING_TEMP_VIDEOS_AND_THUMBNAILS))
} else {
sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY_INCLUDING_TEMP_VIDEOS))

View File

@@ -153,7 +153,7 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
/** @return The ID of the inserted entry, or -1 if none was inserted. Can be used with [addRecipientToExistingEntryIfPossible] */
fun insertIfPossible(recipientId: RecipientId, sentTimestamp: Long, sendMessageResult: SendMessageResult, contentHint: ContentHint, messageId: MessageId, urgent: Boolean): Long {
if (!FeatureFlags.retryReceipts()) return -1
if (!FeatureFlags.retryReceipts) return -1
if (sendMessageResult.isSuccess && sendMessageResult.success.content.isPresent) {
val recipientDevice = listOf(RecipientDevice(recipientId, sendMessageResult.success.devices))
@@ -165,7 +165,7 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
/** @return The ID of the inserted entry, or -1 if none was inserted. Can be used with [addRecipientToExistingEntryIfPossible] */
fun insertIfPossible(recipientId: RecipientId, sentTimestamp: Long, sendMessageResult: SendMessageResult, contentHint: ContentHint, messageIds: List<MessageId>, urgent: Boolean): Long {
if (!FeatureFlags.retryReceipts()) return -1
if (!FeatureFlags.retryReceipts) return -1
if (sendMessageResult.isSuccess && sendMessageResult.success.content.isPresent) {
val recipientDevice = listOf(RecipientDevice(recipientId, sendMessageResult.success.devices))
@@ -177,7 +177,7 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
/** @return The ID of the inserted entry, or -1 if none was inserted. Can be used with [addRecipientToExistingEntryIfPossible] */
fun insertIfPossible(sentTimestamp: Long, possibleRecipients: List<Recipient>, results: List<SendMessageResult>, contentHint: ContentHint, messageId: MessageId, urgent: Boolean): Long {
if (!FeatureFlags.retryReceipts()) return -1
if (!FeatureFlags.retryReceipts) return -1
val accessList = RecipientAccessList(possibleRecipients)
@@ -198,7 +198,7 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
}
fun addRecipientToExistingEntryIfPossible(payloadId: Long, recipientId: RecipientId, sentTimestamp: Long, sendMessageResult: SendMessageResult, contentHint: ContentHint, messageId: MessageId, urgent: Boolean): Long {
if (!FeatureFlags.retryReceipts()) return payloadId
if (!FeatureFlags.retryReceipts) return payloadId
if (sendMessageResult.isSuccess && sendMessageResult.success.content.isPresent) {
val db = databaseHelper.signalWritableDatabase
@@ -274,9 +274,9 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
}
fun getLogEntry(recipientId: RecipientId, device: Int, dateSent: Long): MessageLogEntry? {
if (!FeatureFlags.retryReceipts()) return null
if (!FeatureFlags.retryReceipts) return null
trimOldMessages(System.currentTimeMillis(), FeatureFlags.retryRespondMaxAge())
trimOldMessages(System.currentTimeMillis(), FeatureFlags.retryRespondMaxAge)
val db = databaseHelper.signalReadableDatabase
val table = "${MslPayloadTable.TABLE_NAME} LEFT JOIN ${MslRecipientTable.TABLE_NAME} ON ${MslPayloadTable.TABLE_NAME}.${MslPayloadTable.ID} = ${MslRecipientTable.TABLE_NAME}.${MslRecipientTable.PAYLOAD_ID}"
@@ -356,7 +356,7 @@ class MessageSendLogTables constructor(context: Context?, databaseHelper: Signal
}
fun deleteAllForRecipient(recipientId: RecipientId) {
if (!FeatureFlags.retryReceipts()) return
if (!FeatureFlags.retryReceipts) return
writableDatabase
.delete(MslRecipientTable.TABLE_NAME)

View File

@@ -21,7 +21,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
private var populated: Boolean = false
fun insert(author: RecipientId, authorDevice: Int, sentTimestamp: Long, receivedTimestamp: Long, threadId: Long) {
if (!FeatureFlags.retryReceipts()) return
if (!FeatureFlags.retryReceipts) return
ensurePopulated()
val model: PendingRetryReceiptModel = database.insert(author, authorDevice, sentTimestamp, receivedTimestamp, threadId)
synchronized(pendingRetries) {
@@ -36,7 +36,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
}
fun get(author: RecipientId, sentTimestamp: Long): PendingRetryReceiptModel? {
if (!FeatureFlags.retryReceipts()) return null
if (!FeatureFlags.retryReceipts) return null
ensurePopulated()
synchronized(pendingRetries) {
@@ -45,7 +45,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
}
fun getOldest(): PendingRetryReceiptModel? {
if (!FeatureFlags.retryReceipts()) return null
if (!FeatureFlags.retryReceipts) return null
ensurePopulated()
synchronized(pendingRetries) {
@@ -54,7 +54,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
}
fun delete(model: PendingRetryReceiptModel) {
if (!FeatureFlags.retryReceipts()) return
if (!FeatureFlags.retryReceipts) return
ensurePopulated()
synchronized(pendingRetries) {
@@ -64,7 +64,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
}
fun clear() {
if (!FeatureFlags.retryReceipts()) return
if (!FeatureFlags.retryReceipts) return
synchronized(pendingRetries) {
pendingRetries.clear()

View File

@@ -4152,7 +4152,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
* get them back through CDS).
*/
fun debugClearServiceIds(recipientId: RecipientId? = null) {
check(FeatureFlags.internalUser())
check(FeatureFlags.internalUser)
writableDatabase
.update(TABLE_NAME)
@@ -4177,7 +4177,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
* Should only be used for debugging! A very destructive action that clears all known profile keys and credentials.
*/
fun debugClearProfileData(recipientId: RecipientId? = null) {
check(FeatureFlags.internalUser())
check(FeatureFlags.internalUser)
writableDatabase
.update(TABLE_NAME)
@@ -4208,7 +4208,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
* Should only be used for debugging! Clears the E164 and PNI from a recipient.
*/
fun debugClearE164AndPni(recipientId: RecipientId) {
check(FeatureFlags.internalUser())
check(FeatureFlags.internalUser)
writableDatabase
.update(TABLE_NAME)
@@ -4228,7 +4228,7 @@ open class RecipientTable(context: Context, databaseHelper: SignalDatabase) : Da
* Only works if the recipient has a PNI.
*/
fun debugRemoveAci(recipientId: RecipientId) {
check(FeatureFlags.internalUser())
check(FeatureFlags.internalUser)
writableDatabase.execSQL(
"""

View File

@@ -326,7 +326,7 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
return
}
val syncThreadTrimDeletes = SignalStore.settings().shouldSyncThreadTrimDeletes() && FeatureFlags.deleteSyncEnabled()
val syncThreadTrimDeletes = SignalStore.settings().shouldSyncThreadTrimDeletes() && FeatureFlags.deleteSyncEnabled
val threadTrimsToSync = mutableListOf<Pair<Long, Set<MessageRecord>>>()
readableDatabase
@@ -1131,7 +1131,7 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
var addressableMessages: Set<MessageRecord> = emptySet()
writableDatabase.withinTransaction { db ->
if (syncThreadDeletes && FeatureFlags.deleteSyncEnabled()) {
if (syncThreadDeletes && FeatureFlags.deleteSyncEnabled) {
addressableMessages = messages.getMostRecentAddressableMessages(threadId)
}
@@ -1164,7 +1164,7 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
db.deactivateThread(query)
}
if (FeatureFlags.deleteSyncEnabled()) {
if (FeatureFlags.deleteSyncEnabled) {
for (threadId in selectedConversations) {
addressableMessages += threadId to messages.getMostRecentAddressableMessages(threadId)
}

View File

@@ -71,7 +71,7 @@ object FcmFetchManager {
}
private fun postMayHaveMessagesNotification(context: Context) {
if (FeatureFlags.fcmMayHaveMessagesNotificationKillSwitch()) {
if (FeatureFlags.fcmMayHaveMessagesNotificationKillSwitch) {
Log.w(TAG, "May have messages notification kill switch")
return
}

View File

@@ -222,7 +222,7 @@ class AttachmentDownloadJob private constructor(
attachmentId: AttachmentId,
attachment: DatabaseAttachment
) {
val maxReceiveSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes()
val maxReceiveSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes
val attachmentFile: File = SignalDatabase.attachments.getOrCreateTransferFile(attachmentId)
var archiveFile: File? = null
var useArchiveCdn = false
@@ -401,7 +401,7 @@ class AttachmentDownloadJob private constructor(
S3.getObject(attachment.fileName!!).use { response ->
val body = response.body()
if (body != null) {
if (body.contentLength() > FeatureFlags.maxAttachmentReceiveSizeBytes()) {
if (body.contentLength() > FeatureFlags.maxAttachmentReceiveSizeBytes) {
throw MmsException("Attachment too large, failing download")
}
SignalDatabase.attachments.finalizeAttachmentAfterDownload(messageId, attachmentId, (body.source() as Source).buffer().inputStream())

View File

@@ -66,7 +66,7 @@ class AttachmentUploadJob private constructor(
@JvmStatic
val maxPlaintextSize: Long
get() {
val maxCipherTextSize = FeatureFlags.maxAttachmentSizeBytes()
val maxCipherTextSize = FeatureFlags.maxAttachmentSizeBytes
val maxPaddedSize = AttachmentCipherStreamUtil.getPlaintextLength(maxCipherTextSize)
return PaddingInputStream.getMaxUnpaddedSize(maxPaddedSize)
}

View File

@@ -46,7 +46,7 @@ internal class CallLinkPeekJob private constructor(
)
override fun onRun() {
if (!FeatureFlags.adHocCalling()) {
if (!FeatureFlags.adHocCalling) {
Log.i(TAG, "Ad hoc calling is disabled. Dropping peek for call link.")
return
}

View File

@@ -65,7 +65,7 @@ class CallLinkUpdateSendJob private constructor(
override fun onFailure() = Unit
override fun onRun() {
if (!FeatureFlags.adHocCalling()) {
if (!FeatureFlags.adHocCalling) {
Log.i(TAG, "Call links are not enabled. Exiting.")
return
}

View File

@@ -58,7 +58,7 @@ class MultiDeviceDeleteSendSyncJob private constructor(
return
}
if (!FeatureFlags.deleteSyncEnabled()) {
if (!FeatureFlags.deleteSyncEnabled) {
Log.i(TAG, "Delete sync support not enabled.")
return
}
@@ -74,7 +74,7 @@ class MultiDeviceDeleteSendSyncJob private constructor(
return
}
if (!FeatureFlags.deleteSyncEnabled()) {
if (!FeatureFlags.deleteSyncEnabled) {
Log.i(TAG, "Delete sync support not enabled.")
return
}

View File

@@ -138,7 +138,7 @@ class PreKeysSyncJob private constructor(
warn(TAG, "Forced rotation was requested, but the consistency checks passed!")
val timeSinceLastForcedRotation = System.currentTimeMillis() - SignalStore.misc().lastForcedPreKeyRefresh
// We check < 0 in case someone changed their clock and had a bad value set
timeSinceLastForcedRotation > FeatureFlags.preKeyForceRefreshInterval() || timeSinceLastForcedRotation < 0
timeSinceLastForcedRotation > FeatureFlags.preKeyForceRefreshInterval || timeSinceLastForcedRotation < 0
}
} else {
false

View File

@@ -48,7 +48,7 @@ class ReclaimUsernameAndLinkJob private constructor(parameters: Parameters) : Jo
return when (UsernameRepository.reclaimUsernameIfNecessary()) {
UsernameRepository.UsernameReclaimResult.SUCCESS -> Result.success()
UsernameRepository.UsernameReclaimResult.PERMANENT_ERROR -> Result.success()
UsernameRepository.UsernameReclaimResult.NETWORK_ERROR -> Result.retry(BackoffUtil.exponentialBackoff(runAttempt + 1, FeatureFlags.getDefaultMaxBackoff()))
UsernameRepository.UsernameReclaimResult.NETWORK_ERROR -> Result.retry(BackoffUtil.exponentialBackoff(runAttempt + 1, FeatureFlags.defaultMaxBackoff))
}
}

View File

@@ -208,7 +208,7 @@ class RestoreAttachmentJob private constructor(
attachmentId: AttachmentId,
attachment: DatabaseAttachment
) {
val maxReceiveSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes()
val maxReceiveSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes
val attachmentFile: File = SignalDatabase.attachments.getOrCreateTransferFile(attachmentId)
var archiveFile: File? = null
var useArchiveCdn = false
@@ -439,7 +439,7 @@ class RestoreAttachmentJob private constructor(
return
}
val maxThumbnailSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes()
val maxThumbnailSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes
val thumbnailTransferFile: File = SignalDatabase.attachments.createArchiveThumbnailTransferFile()
val thumbnailFile: File = SignalDatabase.attachments.createArchiveThumbnailTransferFile()

View File

@@ -197,7 +197,7 @@ class RestoreAttachmentThumbnailJob private constructor(
return
}
val maxThumbnailSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes()
val maxThumbnailSize: Long = FeatureFlags.maxAttachmentReceiveSizeBytes
val thumbnailTransferFile: File = SignalDatabase.attachments.createArchiveThumbnailTransferFile()
val thumbnailFile: File = SignalDatabase.attachments.createArchiveThumbnailTransferFile()

View File

@@ -20,7 +20,7 @@ class KeyboardPagerViewModel : ViewModel() {
startingPages.remove(KeyboardPage.EMOJI)
}
if (!FeatureFlags.gifSearchAvailable()) {
if (!FeatureFlags.gifSearchAvailable) {
startingPages.remove(KeyboardPage.GIF)
}

View File

@@ -118,7 +118,7 @@ internal class PaymentsValues internal constructor(store: KeyValueStore) : Signa
if (!SignalStore.account().isRegistered) {
return PaymentsAvailability.NOT_IN_REGION
}
return if (FeatureFlags.payments()) {
return if (FeatureFlags.payments) {
if (mobileCoinPaymentsEnabled()) {
if (GeographicalRestrictions.e164Allowed(SignalStore.account().e164)) {
PaymentsAvailability.WITHDRAW_AND_SEND

View File

@@ -24,11 +24,9 @@ public class LogSectionFeatureFlags implements LogSection {
Map<String, Object> memory = FeatureFlags.getDebugMemoryValues();
Map<String, Object> disk = FeatureFlags.getDebugDiskValues();
Map<String, Object> pending = FeatureFlags.getDebugPendingDiskValues();
Map<String, Object> forced = FeatureFlags.getDebugForcedValues();
int remoteLength = Stream.of(memory.keySet()).map(String::length).max(Integer::compareTo).orElse(0);
int diskLength = Stream.of(disk.keySet()).map(String::length).max(Integer::compareTo).orElse(0);
int pendingLength = Stream.of(pending.keySet()).map(String::length).max(Integer::compareTo).orElse(0);
int forcedLength = Stream.of(forced.keySet()).map(String::length).max(Integer::compareTo).orElse(0);
out.append("-- Memory\n");
for (Map.Entry<String, Object> entry : memory.entrySet()) {
@@ -48,15 +46,6 @@ public class LogSectionFeatureFlags implements LogSection {
}
out.append("\n");
out.append("-- Forced\n");
if (forced.isEmpty()) {
out.append("None\n");
} else {
for (Map.Entry<String, Object> entry : forced.entrySet()) {
out.append(Util.rightPad(entry.getKey(), forcedLength)).append(": ").append(entry.getValue()).append("\n");
}
}
return out;
}
}

View File

@@ -85,7 +85,7 @@ class MediaPreviewRepository {
fun localDelete(attachment: DatabaseAttachment): Completable {
return Completable.fromRunnable {
val deletedMessageRecord = AttachmentUtil.deleteAttachment(attachment)
if (deletedMessageRecord != null && FeatureFlags.deleteSyncEnabled()) {
if (deletedMessageRecord != null && FeatureFlags.deleteSyncEnabled) {
MultiDeviceDeleteSendSyncJob.enqueueMessageDeletes(setOf(deletedMessageRecord))
}
}.subscribeOn(Schedulers.io())

View File

@@ -601,7 +601,7 @@ class MediaPreviewV2Fragment : LoggingFragment(R.layout.fragment_media_preview_v
MaterialAlertDialogBuilder(requireContext()).apply {
setIcon(R.drawable.symbol_error_triangle_fill_24)
setTitle(R.string.MediaPreviewActivity_media_delete_confirmation_title)
setMessage(if (TextSecurePreferences.isMultiDevice(requireContext()) && FeatureFlags.deleteSyncEnabled()) R.string.MediaPreviewActivity_media_delete_confirmation_message_linked_device else R.string.MediaPreviewActivity_media_delete_confirmation_message)
setMessage(if (TextSecurePreferences.isMultiDevice(requireContext()) && FeatureFlags.deleteSyncEnabled) R.string.MediaPreviewActivity_media_delete_confirmation_message_linked_device else R.string.MediaPreviewActivity_media_delete_confirmation_message)
setCancelable(true)
setNegativeButton(android.R.string.cancel, null)
setPositiveButton(R.string.ConversationFragment_delete_for_me) { _, _ ->

View File

@@ -86,7 +86,7 @@ sealed class CameraXModePolicy {
val isMixedModeSupported = isVideoSupported &&
Build.VERSION.SDK_INT >= 26 &&
CameraXUtil.isMixedModeSupported(context) &&
!FeatureFlags.cameraXMixedModelBlocklist().asListContains(Build.MODEL)
!FeatureFlags.cameraXMixedModelBlocklist.asListContains(Build.MODEL)
return when {
isMixedModeSupported -> Mixed(isQrScanEnabled)

View File

@@ -12,6 +12,6 @@ object CameraXModelBlocklist {
@JvmStatic
fun isBlocklisted(): Boolean {
return FeatureFlags.cameraXModelBlocklist().asListContains(Build.MODEL)
return FeatureFlags.cameraXModelBlocklist.asListContains(Build.MODEL)
}
}

View File

@@ -92,7 +92,7 @@ class MediaSelectionActivity :
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
setContentView(R.layout.media_selection_activity)
if (FeatureFlags.customCameraXController()) {
if (FeatureFlags.customCameraXController) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
}

View File

@@ -36,7 +36,7 @@ data class MediaSelectionState(
val transcodingPreset: TranscodingPreset = MediaConstraints.getPushMediaConstraints(SentMediaQuality.fromCode(quality.code)).videoTranscodingSettings
val maxSelection = FeatureFlags.maxAttachmentCount()
val maxSelection = FeatureFlags.maxAttachmentCount
val canSend = !isSent && selectedMedia.isNotEmpty()

View File

@@ -94,7 +94,7 @@ class MediaCaptureFragment : Fragment(R.layout.fragment_container), CameraFragme
.setTitle(R.string.MediaCaptureFragment_device_link_dialog_title)
.setMessage(R.string.MediaCaptureFragment_device_link_dialog_body)
.setPositiveButton(R.string.MediaCaptureFragment_device_link_dialog_continue) { d, _ ->
if (FeatureFlags.internalUser()) {
if (FeatureFlags.internalUser) {
startActivity(AppSettingsActivity.linkedDevices(requireContext()))
} else {
startActivity(DeviceActivity.getIntentForScanner(requireContext()))

View File

@@ -65,7 +65,7 @@ class ChooseGroupStoryBottomSheet : FixedRoundedCornerBottomSheetDialogFragment(
val contactRecycler: RecyclerView = view.findViewById(R.id.contact_recycler)
mediator = ContactSearchMediator(
fragment = this,
selectionLimits = FeatureFlags.shareSelectionLimit(),
selectionLimits = FeatureFlags.shareSelectionLimit,
displayOptions = ContactSearchAdapter.DisplayOptions(
displayCheckBox = true,
displaySecondaryInformation = ContactSearchAdapter.DisplaySecondaryInformation.NEVER

View File

@@ -17,7 +17,7 @@ data class TextStoryPostCreationState(
val body: CharSequence = "",
val textColor: Int = HSVColorSlider.getLastColor(),
val textColorStyle: TextColorStyle = TextColorStyle.NO_BACKGROUND,
val textAlignment: TextAlignment = if (FeatureFlags.storiesTextFunctions()) TextAlignment.START else TextAlignment.CENTER,
val textAlignment: TextAlignment = if (FeatureFlags.storiesTextFunctions) TextAlignment.START else TextAlignment.CENTER,
val textFont: TextFont = TextFont.REGULAR,
@IntRange(from = 0, to = 100) val textScale: Int = 50,
val backgroundColor: ChatColors = TextStoryBackgroundColors.getInitialBackgroundColor(),

View File

@@ -105,7 +105,7 @@ class TextStoryPostTextEntryFragment : KeyboardEntryDialogFragment(
backgroundButton
)
if (FeatureFlags.storiesTextFunctions()) {
if (FeatureFlags.storiesTextFunctions) {
fadeableViews = fadeableViews + alignmentButton
alignmentButton.visibility = View.VISIBLE
scaleBar.visibility = View.VISIBLE

View File

@@ -132,7 +132,7 @@ public final class Megaphones {
return false;
}
long expiringAt = device.lastActiveTimestamp + FeatureFlags.linkedDeviceLifespan();
long expiringAt = device.lastActiveTimestamp + FeatureFlags.getLinkedDeviceLifespan();
long expiringIn = Math.max(expiringAt - System.currentTimeMillis(), 0);
return expiringIn < TimeUnit.DAYS.toMillis(7) && expiringIn > 0;
@@ -177,7 +177,7 @@ public final class Megaphones {
throw new IllegalStateException("No linked device to show");
}
long expiringAt = device.lastActiveTimestamp + FeatureFlags.linkedDeviceLifespan();
long expiringAt = device.lastActiveTimestamp + FeatureFlags.getLinkedDeviceLifespan();
long expiringIn = Math.max(expiringAt - System.currentTimeMillis(), 0);
int expiringDays = (int) TimeUnit.MILLISECONDS.toDays(expiringIn);

View File

@@ -112,7 +112,7 @@ object RemoteMegaphoneRepository {
private fun checkCondition(conditionalId: String): Boolean {
return when (conditionalId) {
"standard_donate" -> shouldShowDonateMegaphone()
"internal_user" -> FeatureFlags.internalUser()
"internal_user" -> FeatureFlags.internalUser
else -> false
}
}

View File

@@ -220,7 +220,7 @@ object DataMessageProcessor {
if (insertResult != null && insertResult.threadWasNewlyCreated && !threadRecipient.isGroup && !threadRecipient.isSelf && !senderRecipient.isSystemContact) {
val timeSinceLastSync = System.currentTimeMillis() - SignalStore.misc().lastCdsForegroundSyncTime
if (timeSinceLastSync > FeatureFlags.cdsForegroundSyncInterval() || timeSinceLastSync < 0) {
if (timeSinceLastSync > FeatureFlags.cdsForegroundSyncInterval || timeSinceLastSync < 0) {
log(envelope.timestamp!!, "New 1:1 chat. Scheduling a CDS sync to see if they match someone in our contacts.")
AppDependencies.jobManager.add(DirectoryRefreshJob(false))
SignalStore.misc().lastCdsForegroundSyncTime = System.currentTimeMillis()

View File

@@ -561,7 +561,7 @@ open class MessageContentProcessor(private val context: Context) {
}
private fun handleRetryReceipt(envelope: Envelope, metadata: EnvelopeMetadata, decryptionErrorMessage: DecryptionErrorMessage, senderRecipient: Recipient) {
if (!FeatureFlags.retryReceipts()) {
if (!FeatureFlags.retryReceipts) {
warn(envelope.timestamp!!, "[RetryReceipt] Feature flag disabled, skipping retry receipt.")
return
}

View File

@@ -156,7 +156,7 @@ object MessageDecryptor {
if (validationResult is EnvelopeContentValidator.Result.Invalid) {
Log.w(TAG, "${logPrefix(envelope, cipherResult)} Invalid content! ${validationResult.reason}", validationResult.throwable)
if (FeatureFlags.internalUser()) {
if (FeatureFlags.internalUser) {
postInvalidMessageNotification(context, validationResult.reason)
}
@@ -213,11 +213,11 @@ object MessageDecryptor {
check(e is ProtocolException)
Log.w(TAG, "${logPrefix(envelope, e)} Decryption error!", e, true)
if (FeatureFlags.internalUser()) {
if (FeatureFlags.internalUser) {
postDecryptionErrorNotification(context)
}
if (FeatureFlags.retryReceipts()) {
if (FeatureFlags.retryReceipts) {
buildResultForDecryptionError(context, envelope, serverDeliveredTimestamp, followUpOperations, e)
} else {
Log.w(TAG, "${logPrefix(envelope, e)} Retry receipts disabled! Enqueuing a session reset job, which will also insert an error message.", e, true)
@@ -296,7 +296,7 @@ object MessageDecryptor {
val errorCount: DecryptionErrorCount = decryptionErrorCounts.getOrPut(sender.id) { DecryptionErrorCount(count = 0, lastReceivedTime = 0) }
val timeSinceLastError = receivedTimestamp - errorCount.lastReceivedTime
if (timeSinceLastError > FeatureFlags.retryReceiptMaxCountResetAge() && errorCount.count > 0) {
if (timeSinceLastError > FeatureFlags.retryReceiptMaxCountResetAge && errorCount.count > 0) {
Log.i(TAG, "${logPrefix(envelope, senderServiceId)} Resetting decryption error count for ${sender.id} because it has been $timeSinceLastError ms since the last error.", true)
errorCount.count = 0
}
@@ -304,8 +304,8 @@ object MessageDecryptor {
errorCount.count++
errorCount.lastReceivedTime = receivedTimestamp
if (errorCount.count > FeatureFlags.retryReceiptMaxCount()) {
Log.w(TAG, "${logPrefix(envelope, senderServiceId)} This is error number ${errorCount.count} from ${sender.id}, which is greater than the maximum of ${FeatureFlags.retryReceiptMaxCount()}. Ignoring.", true)
if (errorCount.count > FeatureFlags.retryReceiptMaxCount) {
Log.w(TAG, "${logPrefix(envelope, senderServiceId)} This is error number ${errorCount.count} from ${sender.id}, which is greater than the maximum of ${FeatureFlags.retryReceiptMaxCount}. Ignoring.", true)
if (contentHint == ContentHint.IMPLICIT) {
Log.w(TAG, "${logPrefix(envelope, senderServiceId)} The content hint is $contentHint, so no error message is needed.", true)

View File

@@ -171,7 +171,7 @@ object SignalServiceProtoUtil {
}
fun List<AttachmentPointer>.toPointersWithinLimit(): List<Attachment> {
return mapNotNull { it.toPointer() }.take(FeatureFlags.maxAttachmentCount())
return mapNotNull { it.toPointer() }.take(FeatureFlags.maxAttachmentCount)
}
fun AttachmentPointer.toPointer(stickerLocator: StickerLocator? = null): Attachment? {

View File

@@ -90,7 +90,7 @@ object StoryMessageProcessor {
}
if (insertResult != null) {
Stories.enqueueNextStoriesForDownload(threadRecipient.id, false, FeatureFlags.storiesAutoDownloadMaximum())
Stories.enqueueNextStoriesForDownload(threadRecipient.id, false, FeatureFlags.storiesAutoDownloadMaximum)
AppDependencies.expireStoriesManager.scheduleIfNecessary()
}
}

View File

@@ -1368,7 +1368,7 @@ object SyncMessageProcessor {
@Throws(BadGroupIdException::class)
private fun handleSynchronizeGroupOrAdHocCallEvent(callEvent: SyncMessage.CallEvent, envelopeTimestamp: Long) {
if (!FeatureFlags.adHocCalling() && callEvent.type == SyncMessage.CallEvent.Type.AD_HOC_CALL) {
if (!FeatureFlags.adHocCalling && callEvent.type == SyncMessage.CallEvent.Type.AD_HOC_CALL) {
log(envelopeTimestamp, "Ad-Hoc calling is not currently supported by this client, ignoring.")
return
}
@@ -1475,7 +1475,7 @@ object SyncMessageProcessor {
}
private fun handleSynchronizeDeleteForMe(context: Context, deleteForMe: SyncMessage.DeleteForMe, envelopeTimestamp: Long, earlyMessageCacheEntry: EarlyMessageCacheEntry?) {
if (!FeatureFlags.deleteSyncEnabled()) {
if (!FeatureFlags.deleteSyncEnabled) {
warn(envelopeTimestamp, "Delete for me sync message dropped as support not enabled")
return
}

View File

@@ -37,7 +37,7 @@ class DefaultWebSocketShadowingBridge(private val context: Application) : WebSoc
}
override fun triggerFailureNotification(message: String) {
if (!FeatureFlags.internalUser()) {
if (!FeatureFlags.internalUser) {
return
}
val notification: Notification = NotificationCompat.Builder(context, NotificationChannels.getInstance().FAILURES)

View File

@@ -36,7 +36,7 @@ object SlowNotificationHeuristics {
private val TAG = Log.tag(SlowNotificationHeuristics::class.java)
fun getConfiguration(): Configuration {
val json = FeatureFlags.delayedNotificationsPromptConfig()
val json = FeatureFlags.delayedNotificationsPromptConfig
return if (TextUtils.isEmpty(json)) {
getDefaultConfiguration()
} else {

View File

@@ -41,7 +41,7 @@ object NotificationThumbnails {
* specifics here, we'll just disable notification thumbnails for them.
*/
private val isBlocklisted by lazy {
FeatureFlags.notificationThumbnailProductBlocklist().asListContains(Build.PRODUCT)
FeatureFlags.notificationThumbnailProductBlocklist.asListContains(Build.PRODUCT)
}
fun getWithoutModifying(notificationItem: NotificationItem): NotificationItem.ThumbnailInfo {

View File

@@ -19,11 +19,11 @@ object Svr3Migration {
* Whether or not you should write to SVR3. If [shouldWriteToSvr2] is also enabled, you should write to SVR3 first.
*/
val shouldWriteToSvr3: Boolean
get() = shouldReadFromSvr3 && FeatureFlags.svr3MigrationPhase().let { it == 1 || it == 2 }
get() = shouldReadFromSvr3 && FeatureFlags.svr3MigrationPhase.let { it == 1 || it == 2 }
/**
* Whether or not you should write to SVR2. If [shouldWriteToSvr3] is also enabled, you should write to SVR3 first.
*/
val shouldWriteToSvr2: Boolean
get() = !shouldReadFromSvr3 || FeatureFlags.svr3MigrationPhase() != 2
get() = !shouldReadFromSvr3 || FeatureFlags.svr3MigrationPhase != 2
}

View File

@@ -86,7 +86,7 @@ class RegistrationV2Activity : BaseActivity() {
val startIntent = MainActivity.clearTop(this).apply {
if (needsPin) {
putExtra("next_intent", CreateSvrPinActivity.getIntentForPinCreate(this@RegistrationV2Activity))
} else if (!SignalStore.registrationValues().hasSkippedTransferOrRestore() && FeatureFlags.messageBackups()) {
} else if (!SignalStore.registrationValues().hasSkippedTransferOrRestore() && FeatureFlags.messageBackups) {
putExtra("next_intent", RemoteRestoreActivity.getIntent(this@RegistrationV2Activity))
} else if (needsProfile) {
putExtra("next_intent", CreateProfileActivity.getIntentForUserProfile(this@RegistrationV2Activity))

View File

@@ -61,7 +61,7 @@ class WelcomeV2Fragment : LoggingFragment(R.layout.fragment_registration_welcome
binding.welcomeContinueButton.setOnClickListener { onContinueClicked() }
binding.welcomeTermsButton.setOnClickListener { onTermsClicked() }
binding.welcomeTransferOrRestore.setOnClickListener { onTransferOrRestoreClicked() }
binding.welcomeTransferOrRestore.visible = !FeatureFlags.restoreAfterRegistration()
binding.welcomeTransferOrRestore.visible = !FeatureFlags.restoreAfterRegistration
}
private fun onContinueClicked() {

View File

@@ -47,8 +47,8 @@ class TransferOrRestoreV2Fragment : LoggingFragment(R.layout.fragment_transfer_r
binding.transferOrRestoreFragmentRestoreRemoteCard.visible = false
}
binding.transferOrRestoreFragmentRestoreRemoteCard.visible = FeatureFlags.messageBackups()
binding.transferOrRestoreFragmentMoreOptions.visible = FeatureFlags.messageBackups()
binding.transferOrRestoreFragmentRestoreRemoteCard.visible = FeatureFlags.messageBackups
binding.transferOrRestoreFragmentMoreOptions.visible = FeatureFlags.messageBackups
val description = getString(R.string.TransferOrRestoreFragment__transfer_your_account_and_messages_from_your_old_android_device)
val toBold = getString(R.string.TransferOrRestoreFragment__you_need_access_to_your_old_device)

View File

@@ -36,7 +36,7 @@ class MessageBackupListener : PersistentAlarmManagerListener() {
@JvmStatic
fun schedule(context: Context?) {
if (FeatureFlags.messageBackups() && SignalStore.backup().areBackupsEnabled) {
if (FeatureFlags.messageBackups && SignalStore.backup().areBackupsEnabled) {
MessageBackupListener().onReceive(context, getScheduleIntent())
}
}

View File

@@ -192,7 +192,7 @@ object AndroidTelecomUtil {
}
private fun isTelecomAllowedForDevice(): Boolean {
if (FeatureFlags.internalUser()) {
if (FeatureFlags.internalUser) {
return !SignalStore.internalValues().callingDisableTelecom()
}
return RingRtcDynamicConfiguration.isTelecomAllowedForDevice()

View File

@@ -22,19 +22,19 @@ object RingRtcDynamicConfiguration {
return when {
isHardwareBlocklisted() || isKnownFaultyHardwareImplementation() -> AudioProcessingMethod.ForceSoftwareAec3
isSoftwareBlocklisted() -> AudioProcessingMethod.ForceHardware
Build.VERSION.SDK_INT < 29 && FeatureFlags.useHardwareAecIfOlderThanApi29() -> AudioProcessingMethod.ForceHardware
Build.VERSION.SDK_INT < 29 && FeatureFlags.useHardwareAecIfOlderThanApi29 -> AudioProcessingMethod.ForceHardware
Build.VERSION.SDK_INT < 29 -> AudioProcessingMethod.ForceSoftwareAec3
else -> AudioProcessingMethod.ForceHardware
}
}
fun isTelecomAllowedForDevice(): Boolean {
return FeatureFlags.telecomManufacturerAllowList().lowercase().asListContains(Build.MANUFACTURER.lowercase()) &&
!FeatureFlags.telecomModelBlockList().lowercase().asListContains(Build.MODEL.lowercase())
return FeatureFlags.telecomManufacturerAllowList.lowercase().asListContains(Build.MANUFACTURER.lowercase()) &&
!FeatureFlags.telecomModelBlocklist.lowercase().asListContains(Build.MODEL.lowercase())
}
private fun isHardwareBlocklisted(): Boolean {
return FeatureFlags.hardwareAecBlocklistModels().asListContains(Build.MODEL)
return FeatureFlags.hardwareAecBlocklistModels.asListContains(Build.MODEL)
}
fun isKnownFaultyHardwareImplementation(): Boolean {
@@ -44,6 +44,6 @@ object RingRtcDynamicConfiguration {
}
private fun isSoftwareBlocklisted(): Boolean {
return FeatureFlags.softwareAecBlocklistModels().asListContains(Build.MODEL)
return FeatureFlags.softwareAecBlocklistModels.asListContains(Build.MODEL)
}
}

View File

@@ -82,7 +82,7 @@ class ShareRepository(context: Context) {
}
val media: List<Media> = mimeTypes.toList()
.take(FeatureFlags.maxAttachmentCount())
.take(FeatureFlags.maxAttachmentCount)
.map { (uri, mimeType) ->
val stream: InputStream = try {
appContext.contentResolver.openInputStream(uri)

View File

@@ -172,7 +172,7 @@ class StoryViewerViewModel(
.filter { it != RecipientId.UNKNOWN }
.distinctUntilChanged()
.subscribe {
Stories.enqueueNextStoriesForDownload(it, true, FeatureFlags.storiesAutoDownloadMaximum())
Stories.enqueueNextStoriesForDownload(it, true, FeatureFlags.storiesAutoDownloadMaximum)
}
}

View File

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

View File

@@ -116,7 +116,7 @@ class VerifyDisplayFragment : Fragment(), OnScrollChangedListener {
if (fingerprints.isEmpty()) {
val resolved = viewModel.recipient.resolve()
Log.w(TAG, String.format(Locale.ENGLISH, "Could not show proper verification! verifyV2: %s, hasUuid: %s, hasE164: %s", FeatureFlags.verifyV2(), resolved.serviceId.isPresent, resolved.e164.isPresent))
Log.w(TAG, String.format(Locale.ENGLISH, "Could not show proper verification! verifyV2: %s, hasUuid: %s, hasE164: %s", FeatureFlags.verifyV2, resolved.serviceId.isPresent, resolved.e164.isPresent))
MaterialAlertDialogBuilder(requireContext())
.setMessage(getString(R.string.VerifyIdentityActivity_you_must_first_exchange_messages_in_order_to_view, resolved.getDisplayName(requireContext())))
.setPositiveButton(android.R.string.ok) { dialog: DialogInterface?, which: Int -> requireActivity().finish() }