mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Rename FeatureFlags -> RemoteConfig.
This commit is contained in:
@@ -9,9 +9,9 @@ import org.signal.core.util.requireLong
|
||||
import org.signal.core.util.requireNonNullString
|
||||
import org.thoughtcrime.securesms.attachments.DatabaseAttachment
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.MediaUtil
|
||||
import org.thoughtcrime.securesms.util.MediaUtil.SlideType
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
|
||||
@SuppressLint("RecipientIdDatabaseReferenceUsage", "ThreadIdDatabaseReferenceUsage") // Not a real table, just a view
|
||||
class MediaTable internal constructor(context: Context?, databaseHelper: SignalDatabase?) : DatabaseTable(context, databaseHelper) {
|
||||
@@ -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 (RemoteConfig.messageBackups) {
|
||||
sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY_INCLUDING_TEMP_VIDEOS_AND_THUMBNAILS))
|
||||
} else {
|
||||
sorting.applyToQuery(applyEqualityOperator(threadId, GALLERY_MEDIA_QUERY_INCLUDING_TEMP_VIDEOS))
|
||||
|
||||
@@ -15,8 +15,8 @@ import org.thoughtcrime.securesms.database.model.MessageId
|
||||
import org.thoughtcrime.securesms.database.model.MessageLogEntry
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.RecipientAccessList
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.whispersystems.signalservice.api.crypto.ContentHint
|
||||
import org.whispersystems.signalservice.api.messages.SendMessageResult
|
||||
import org.whispersystems.signalservice.internal.push.Content
|
||||
@@ -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 (!RemoteConfig.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 (!RemoteConfig.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 (!RemoteConfig.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 (!RemoteConfig.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 (!RemoteConfig.retryReceipts) return null
|
||||
|
||||
trimOldMessages(System.currentTimeMillis(), FeatureFlags.retryRespondMaxAge)
|
||||
trimOldMessages(System.currentTimeMillis(), RemoteConfig.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 (!RemoteConfig.retryReceipts) return
|
||||
|
||||
writableDatabase
|
||||
.delete(MslRecipientTable.TABLE_NAME)
|
||||
|
||||
@@ -3,7 +3,7 @@ package org.thoughtcrime.securesms.database
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import org.thoughtcrime.securesms.database.model.PendingRetryReceiptModel
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
|
||||
/**
|
||||
* A write-through cache for [PendingRetryReceiptTable].
|
||||
@@ -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 (!RemoteConfig.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 (!RemoteConfig.retryReceipts) return null
|
||||
ensurePopulated()
|
||||
|
||||
synchronized(pendingRetries) {
|
||||
@@ -45,7 +45,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
|
||||
}
|
||||
|
||||
fun getOldest(): PendingRetryReceiptModel? {
|
||||
if (!FeatureFlags.retryReceipts) return null
|
||||
if (!RemoteConfig.retryReceipts) return null
|
||||
ensurePopulated()
|
||||
|
||||
synchronized(pendingRetries) {
|
||||
@@ -54,7 +54,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
|
||||
}
|
||||
|
||||
fun delete(model: PendingRetryReceiptModel) {
|
||||
if (!FeatureFlags.retryReceipts) return
|
||||
if (!RemoteConfig.retryReceipts) return
|
||||
ensurePopulated()
|
||||
|
||||
synchronized(pendingRetries) {
|
||||
@@ -64,7 +64,7 @@ class PendingRetryReceiptCache @VisibleForTesting constructor(
|
||||
}
|
||||
|
||||
fun clear() {
|
||||
if (!FeatureFlags.retryReceipts) return
|
||||
if (!RemoteConfig.retryReceipts) return
|
||||
|
||||
synchronized(pendingRetries) {
|
||||
pendingRetries.clear()
|
||||
|
||||
@@ -92,9 +92,9 @@ import org.thoughtcrime.securesms.service.webrtc.links.CallLinkRoomId
|
||||
import org.thoughtcrime.securesms.storage.StorageRecordUpdate
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncModels
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.IdentityUtil
|
||||
import org.thoughtcrime.securesms.util.ProfileUtil
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.thoughtcrime.securesms.wallpaper.ChatWallpaper
|
||||
import org.thoughtcrime.securesms.wallpaper.WallpaperStorage
|
||||
@@ -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(RemoteConfig.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(RemoteConfig.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(RemoteConfig.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(RemoteConfig.internalUser)
|
||||
|
||||
writableDatabase.execSQL(
|
||||
"""
|
||||
|
||||
@@ -62,10 +62,10 @@ import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.recipients.RecipientUtil
|
||||
import org.thoughtcrime.securesms.storage.StorageSyncHelper
|
||||
import org.thoughtcrime.securesms.util.ConversationUtil
|
||||
import org.thoughtcrime.securesms.util.FeatureFlags
|
||||
import org.thoughtcrime.securesms.util.JsonUtils
|
||||
import org.thoughtcrime.securesms.util.JsonUtils.SaneJSONObject
|
||||
import org.thoughtcrime.securesms.util.LRUCache
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.isScheduled
|
||||
import org.whispersystems.signalservice.api.storage.SignalAccountRecord
|
||||
@@ -326,7 +326,7 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
|
||||
return
|
||||
}
|
||||
|
||||
val syncThreadTrimDeletes = SignalStore.settings().shouldSyncThreadTrimDeletes() && FeatureFlags.deleteSyncEnabled
|
||||
val syncThreadTrimDeletes = SignalStore.settings().shouldSyncThreadTrimDeletes() && RemoteConfig.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 && RemoteConfig.deleteSyncEnabled) {
|
||||
addressableMessages = messages.getMostRecentAddressableMessages(threadId)
|
||||
}
|
||||
|
||||
@@ -1164,7 +1164,7 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
|
||||
db.deactivateThread(query)
|
||||
}
|
||||
|
||||
if (FeatureFlags.deleteSyncEnabled) {
|
||||
if (RemoteConfig.deleteSyncEnabled) {
|
||||
for (threadId in selectedConversations) {
|
||||
addressableMessages += threadId to messages.getMostRecentAddressableMessages(threadId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user