mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-03 15:11:42 +01:00
Update conversation header and message request UI.
This commit is contained in:
committed by
jeffrey-signal
parent
c2d927029a
commit
4756b8d70b
@@ -144,11 +144,8 @@ public final class MessageRequestRepository {
|
||||
} else {
|
||||
Recipient.HiddenState hiddenState = RecipientUtil.getRecipientHiddenState(threadId);
|
||||
boolean reportedAsSpam = reportedAsSpam(threadId);
|
||||
List<String> sharedGroups = SignalDatabase.groups().getPushGroupNamesContainingMember(recipient.getId());
|
||||
|
||||
if (hiddenState == Recipient.HiddenState.NOT_HIDDEN && sharedGroups.size() < MIN_GROUPS_THRESHOLD) {
|
||||
return new MessageRequestState(MessageRequestState.State.INDIVIDUAL_FEW_CONNECTIONS, reportedAsSpam);
|
||||
} else if (hiddenState == Recipient.HiddenState.NOT_HIDDEN) {
|
||||
if (hiddenState == Recipient.HiddenState.NOT_HIDDEN) {
|
||||
return new MessageRequestState(MessageRequestState.State.INDIVIDUAL, reportedAsSpam);
|
||||
} else if (hiddenState == Recipient.HiddenState.HIDDEN) {
|
||||
return new MessageRequestState(MessageRequestState.State.NONE_HIDDEN, reportedAsSpam);
|
||||
|
||||
@@ -19,8 +19,8 @@ data class MessageRequestState @JvmOverloads constructor(val state: State = Stat
|
||||
val isBlocked: Boolean
|
||||
get() = state == State.INDIVIDUAL_BLOCKED || state == State.BLOCKED_GROUP
|
||||
|
||||
val isFewConnectionsIndividual: Boolean
|
||||
get() = state == State.INDIVIDUAL_FEW_CONNECTIONS
|
||||
val isIndividual: Boolean
|
||||
get() = state == State.INDIVIDUAL || state == State.INDIVIDUAL_HIDDEN
|
||||
|
||||
val isGroupV2Add: Boolean
|
||||
get() = state == State.GROUP_V2_ADD
|
||||
@@ -56,9 +56,6 @@ data class MessageRequestState @JvmOverloads constructor(val state: State = Stat
|
||||
/** A user is blocked */
|
||||
INDIVIDUAL_BLOCKED,
|
||||
|
||||
/** A message request and secondary confirmation is needed for an individual with less than 2 common groups */
|
||||
INDIVIDUAL_FEW_CONNECTIONS,
|
||||
|
||||
/** A message request is needed for an individual since they have been hidden */
|
||||
INDIVIDUAL_HIDDEN
|
||||
}
|
||||
|
||||
@@ -5,14 +5,18 @@ import android.content.res.ColorStateList
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import org.signal.core.util.dp
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.fonts.SignalSymbols
|
||||
import org.thoughtcrime.securesms.messagerequests.MessageRequestBarColorTheme.Companion.resolveTheme
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.CommunicationActions
|
||||
import org.thoughtcrime.securesms.util.Debouncer
|
||||
import org.thoughtcrime.securesms.util.padding
|
||||
import org.thoughtcrime.securesms.util.views.LearnMoreTextView
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
|
||||
@@ -22,6 +26,7 @@ import org.thoughtcrime.securesms.util.visible
|
||||
class MessageRequestsBottomView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
private val showProgressDebouncer = Debouncer(250)
|
||||
|
||||
private val title: TextView
|
||||
private val question: LearnMoreTextView
|
||||
private val accept: MaterialButton
|
||||
private val block: MaterialButton
|
||||
@@ -34,6 +39,7 @@ class MessageRequestsBottomView @JvmOverloads constructor(context: Context, attr
|
||||
init {
|
||||
inflate(context, R.layout.message_request_bottom_bar, this)
|
||||
|
||||
title = findViewById(R.id.message_request_title)
|
||||
question = findViewById(R.id.message_request_question)
|
||||
accept = findViewById(R.id.message_request_accept)
|
||||
block = findViewById(R.id.message_request_block)
|
||||
@@ -51,6 +57,7 @@ class MessageRequestsBottomView @JvmOverloads constructor(context: Context, attr
|
||||
question.setOnLinkClickListener(null)
|
||||
|
||||
updateButtonVisibility(messageRequestState)
|
||||
updateTitleVisibility(messageRequestState)
|
||||
|
||||
when (messageRequestState.state) {
|
||||
MessageRequestState.State.INDIVIDUAL_BLOCKED -> {
|
||||
@@ -91,25 +98,8 @@ class MessageRequestsBottomView @JvmOverloads constructor(context: Context, attr
|
||||
}
|
||||
|
||||
MessageRequestState.State.INDIVIDUAL,
|
||||
MessageRequestState.State.INDIVIDUAL_FEW_CONNECTIONS -> {
|
||||
question.text = HtmlCompat.fromHtml(
|
||||
context.getString(
|
||||
R.string.MessageRequestBottomView_do_you_want_to_let_s_message_you_they_wont_know_youve_seen_their_messages_until_you_accept,
|
||||
bold(recipient.getShortDisplayName(context))
|
||||
),
|
||||
0
|
||||
)
|
||||
accept.setText(R.string.MessageRequestBottomView_accept)
|
||||
}
|
||||
|
||||
MessageRequestState.State.INDIVIDUAL_HIDDEN -> {
|
||||
question.text = HtmlCompat.fromHtml(
|
||||
context.getString(
|
||||
R.string.MessageRequestBottomView_do_you_want_to_let_s_message_you_you_removed_them_before,
|
||||
bold(recipient.getShortDisplayName(context))
|
||||
),
|
||||
0
|
||||
)
|
||||
question.setText(R.string.MessageRequestBottomView_do_you_want_to_let_s_message_you_they_wont_know_youve_seen_their_messages_until_you_accept)
|
||||
accept.setText(R.string.MessageRequestBottomView_accept)
|
||||
}
|
||||
|
||||
@@ -126,6 +116,22 @@ class MessageRequestsBottomView @JvmOverloads constructor(context: Context, attr
|
||||
report.visible = !messageState.reportedAsSpam
|
||||
}
|
||||
|
||||
private fun updateTitleVisibility(messageState: MessageRequestState) {
|
||||
title.visible = !messageState.isBlocked
|
||||
if (title.visible) {
|
||||
title.text = SignalSymbols.getSignalSymbolText(
|
||||
context = context,
|
||||
text = context.getString(R.string.AboutSheet__review_requests_carefully),
|
||||
glyphStart = SignalSymbols.Glyph.ERROR_TRIANGLE,
|
||||
glyphStartWeight = SignalSymbols.Weight.REGULAR,
|
||||
glyphStartSizeSp = 14
|
||||
)
|
||||
question.padding(top = 0)
|
||||
} else {
|
||||
question.padding(top = 16.dp)
|
||||
}
|
||||
}
|
||||
|
||||
fun showBusy() {
|
||||
showProgressDebouncer.publish { busyIndicator.visibility = VISIBLE }
|
||||
buttonBar.visibility = INVISIBLE
|
||||
|
||||
Reference in New Issue
Block a user