Inline pinned message config.

This commit is contained in:
Michelle Tang
2026-03-16 21:19:13 -04:00
parent fc0e902cbf
commit b677827c86
5 changed files with 4 additions and 35 deletions

View File

@@ -171,11 +171,11 @@ public final class MenuState {
hasPollTerminate = true;
}
if (RemoteConfig.sendPinnedMessages() && !messageRecord.isPending() && messageRecord.getPinnedUntil() == 0 && !conversationRecipient.isReleaseNotes() && canEditGroupInfo && !hasGift) {
if (!messageRecord.isPending() && messageRecord.getPinnedUntil() == 0 && !conversationRecipient.isReleaseNotes() && canEditGroupInfo && !hasGift) {
canPinMessage = true;
}
if (RemoteConfig.sendPinnedMessages() && messageRecord.getPinnedUntil() != 0 && !conversationRecipient.isReleaseNotes() && canEditGroupInfo && !hasGift) {
if (messageRecord.getPinnedUntil() != 0 && !conversationRecipient.isReleaseNotes() && canEditGroupInfo && !hasGift) {
canUnpinMessage = true;
}
}

View File

@@ -1425,7 +1425,7 @@ class ConversationFragment :
private fun presentPinnedMessage(pinnedMessages: List<ConversationMessage>, hasWallpaper: Boolean) {
if (pinnedMessages.isNotEmpty()) {
binding.conversationBanner.showPinnedMessageStub(messages = pinnedMessages, canUnpin = conversationGroupViewModel.canEditGroupInfo() && RemoteConfig.sendPinnedMessages, hasWallpaper = hasWallpaper, shouldAnimate = !firstPinRender)
binding.conversationBanner.showPinnedMessageStub(messages = pinnedMessages, canUnpin = conversationGroupViewModel.canEditGroupInfo(), hasWallpaper = hasWallpaper, shouldAnimate = !firstPinRender)
} else {
binding.conversationBanner.hidePinnedMessageStub()
}
@@ -4441,7 +4441,7 @@ class ConversationFragment :
childFragmentManager,
threadId = args.threadId,
conversationRecipientId = viewModel.recipientSnapshot?.id!!,
canUnpin = conversationGroupViewModel.canEditGroupInfo() && RemoteConfig.sendPinnedMessages
canUnpin = conversationGroupViewModel.canEditGroupInfo()
)
}
}

View File

@@ -1272,11 +1272,6 @@ object DataMessageProcessor {
receivedTime: Long,
earlyMessageCacheEntry: EarlyMessageCacheEntry? = null
): InsertResult? {
if (!RemoteConfig.receivePinnedMessages) {
log(envelope.timestamp!!, "Pinned message not allowed due to remote config.")
return null
}
val pinMessage = message.pinMessage!!
log(envelope.timestamp!!, "[handlePinMessage] Pin message for " + pinMessage.targetSentTimestamp)
@@ -1371,11 +1366,6 @@ object DataMessageProcessor {
threadRecipient: Recipient,
earlyMessageCacheEntry: EarlyMessageCacheEntry? = null
): MessageId? {
if (!RemoteConfig.receivePinnedMessages) {
log(envelope.timestamp!!, "Unpinning message is not allowed due to remote config.")
return null
}
val unpinMessage = message.unpinMessage!!
log(envelope.timestamp!!, "[handleUnpinMessage] Unpin message for ${unpinMessage.targetSentTimestamp}")

View File

@@ -110,7 +110,6 @@ import org.thoughtcrime.securesms.util.EarlyMessageCacheEntry
import org.thoughtcrime.securesms.util.IdentityUtil
import org.thoughtcrime.securesms.util.MediaUtil
import org.thoughtcrime.securesms.util.MessageConstraintsUtil
import org.thoughtcrime.securesms.util.RemoteConfig
import org.thoughtcrime.securesms.util.SignalE164Util
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.thoughtcrime.securesms.util.hasGiftBadge
@@ -1873,10 +1872,6 @@ object SyncMessageProcessor {
senderRecipient: Recipient,
earlyMessageCacheEntry: EarlyMessageCacheEntry?
): Long {
if (!RemoteConfig.receivePinnedMessages) {
log(envelope.timestamp!!, "Sync pinned messages not allowed due to remote config.")
}
log(envelope.timestamp!!, "Synchronize pinned message")
val recipient = getSyncMessageDestination(sent)

View File

@@ -1216,22 +1216,6 @@ object RemoteConfig {
hotSwappable = true
)
@JvmStatic
@get:JvmName("receivePinnedMessages")
val receivePinnedMessages: Boolean by remoteBoolean(
key = "android.receivePinnedMessages.2",
defaultValue = false,
hotSwappable = true
)
@JvmStatic
@get:JvmName("sendPinnedMessages")
val sendPinnedMessages: Boolean by remoteBoolean(
key = "android.sendPinnedMessages.2",
defaultValue = false,
hotSwappable = true
)
@JvmStatic
@get:JvmName("callQualitySurvey")
val callQualitySurvey: Boolean by remoteBoolean(