mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-08-04 20:34:14 +01:00
Enable 1:1 polls.
This commit is contained in:
@@ -66,7 +66,6 @@ import org.signal.core.ui.compose.list.reorderableList
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.polls.Poll
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import org.thoughtcrime.securesms.util.ViewUtil
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@@ -78,7 +77,7 @@ class CreatePollFragment : ComposeDialogFragment() {
|
||||
companion object {
|
||||
private val TAG = Log.tag(CreatePollFragment::class)
|
||||
|
||||
val MAX_QUESTION_CHARACTER_LENGTH = if (RemoteConfig.pollsV2) 200 else 100
|
||||
const val MAX_QUESTION_CHARACTER_LENGTH = 200
|
||||
const val MAX_CHARACTER_LENGTH = 100
|
||||
const val MAX_OPTIONS = 10
|
||||
const val MIN_OPTIONS = 2
|
||||
|
||||
+2
-9
@@ -27,7 +27,6 @@ import org.thoughtcrime.securesms.conversation.ManageContextMenu
|
||||
import org.thoughtcrime.securesms.conversation.v2.ConversationViewModel
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import java.util.function.Predicate
|
||||
|
||||
/**
|
||||
@@ -49,7 +48,6 @@ class AttachmentKeyboardFragment : LoggingFragment(R.layout.attachment_keyboard_
|
||||
|
||||
private val lifecycleDisposable = LifecycleDisposable()
|
||||
private val removePaymentFilter: Predicate<AttachmentKeyboardButton> = Predicate { button -> button != AttachmentKeyboardButton.PAYMENT }
|
||||
private val removePollFilter: Predicate<AttachmentKeyboardButton> = Predicate { button -> button != AttachmentKeyboardButton.POLL }
|
||||
|
||||
@Suppress("ReplaceGetOrSet")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@@ -131,15 +129,10 @@ class AttachmentKeyboardFragment : LoggingFragment(R.layout.attachment_keyboard_
|
||||
private fun updateButtonsAvailable(recipient: Recipient) {
|
||||
val paymentsValues = SignalStore.payments
|
||||
val isPaymentsAvailable = paymentsValues.paymentsAvailability.isSendAllowed && !recipient.isSelf && !recipient.isGroup && recipient.isRegistered
|
||||
val isPollsAvailable = recipient.isPushV2Group || RemoteConfig.pollsV2
|
||||
|
||||
if (!isPaymentsAvailable && !isPollsAvailable) {
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons(removePaymentFilter.and(removePollFilter))
|
||||
} else if (!isPaymentsAvailable) {
|
||||
if (!isPaymentsAvailable) {
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons(removePaymentFilter)
|
||||
} else if (!isPollsAvailable) (
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons(removePollFilter)
|
||||
) else {
|
||||
} else {
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons(null)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1255,17 +1255,6 @@ object RemoteConfig {
|
||||
hotSwappable = true
|
||||
)
|
||||
|
||||
/**
|
||||
* Whether or not to allow 1:1 polls and a higher character limit for questions
|
||||
*/
|
||||
@JvmStatic
|
||||
@get:JvmName("pollsV2")
|
||||
val pollsV2: Boolean by remoteBoolean(
|
||||
key = "android.pollsV2",
|
||||
defaultValue = false,
|
||||
hotSwappable = true
|
||||
)
|
||||
|
||||
/**
|
||||
* Whether or not to receive admin delete messages.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user