Make attachment count/size remote configurable.

This commit is contained in:
Greyson Parrelli
2023-05-18 21:19:04 -04:00
committed by Nicholas Tinsley
parent 938c82be3f
commit 4d6d31d624
5 changed files with 34 additions and 11 deletions

View File

@@ -10,6 +10,7 @@ import org.thoughtcrime.securesms.attachments.PointerAttachment
import org.thoughtcrime.securesms.database.model.StoryType
import org.thoughtcrime.securesms.groups.GroupId
import org.thoughtcrime.securesms.stickers.StickerLocator
import org.thoughtcrime.securesms.util.FeatureFlags
import org.thoughtcrime.securesms.util.MediaUtil
import org.whispersystems.signalservice.api.InvalidMessageStructureException
import org.whispersystems.signalservice.api.crypto.EnvelopeMetadata
@@ -31,8 +32,6 @@ private val ByteString.isNotEmpty: Boolean
object SignalServiceProtoUtil {
const val MAX_ALLOWED_ATTACHMENTS = 100
/** Contains some user data that affects the conversation */
val DataMessage.hasRenderableContent: Boolean
get() {
@@ -161,7 +160,7 @@ object SignalServiceProtoUtil {
}
fun List<AttachmentPointer>.toPointersWithinLimit(): List<Attachment> {
return mapNotNull { it.toPointer() }.take(MAX_ALLOWED_ATTACHMENTS)
return mapNotNull { it.toPointer() }.take(FeatureFlags.maxAttachmentCount())
}
fun AttachmentPointer.toPointer(stickerLocator: StickerLocator? = null): Attachment? {