mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 09:49:30 +01:00
Fixes for CFv2.
- Status bar color being incorrect when entering a screen that changes it and then returning (e.g., Message Details) - Fix crash in enter sends mode - Fix warning about non-closed cursor - Prevent message abandonment (via trim thread) when it's the first in an inactive thread - Fix payment attachment button flashing on attachment keyboard open if payments disabled - Fix reactionDelegate crash - Fix attachment preview (file, mp3, location, etc) not getting cleared on send
This commit is contained in:
@@ -1993,7 +1993,7 @@ public class ConversationParentFragment extends Fragment
|
||||
|
||||
voiceNoteMediaController.getVoiceNotePlaybackState().observe(getViewLifecycleOwner(), inputPanel.getPlaybackStateObserver());
|
||||
|
||||
material3OnScrollHelper = new Material3OnScrollHelper(requireActivity(), Collections.singletonList(toolbarBackground), Collections.emptyList()) {
|
||||
material3OnScrollHelper = new Material3OnScrollHelper(requireActivity(), Collections.singletonList(toolbarBackground), Collections.emptyList(), getViewLifecycleOwner()) {
|
||||
@Override
|
||||
public @NonNull ColorSet getActiveColorSet() {
|
||||
return new ColorSet(getActiveToolbarColor(wallpaper.getDrawable() != null));
|
||||
|
||||
@@ -58,6 +58,7 @@ import androidx.fragment.app.activityViewModels
|
||||
import androidx.fragment.app.commit
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
@@ -510,7 +511,8 @@ class ConversationFragment :
|
||||
val conversationToolbarOnScrollHelper = ConversationToolbarOnScrollHelper(
|
||||
requireActivity(),
|
||||
binding.toolbarBackground,
|
||||
viewModel::wallpaperSnapshot
|
||||
viewModel::wallpaperSnapshot,
|
||||
viewLifecycleOwner
|
||||
)
|
||||
conversationToolbarOnScrollHelper.attach(binding.conversationItemRecycler)
|
||||
presentWallpaper(args.wallpaper)
|
||||
@@ -561,8 +563,6 @@ class ConversationFragment :
|
||||
ApplicationDependencies.getMessageNotifier().setVisibleThread(ConversationId.forConversation(args.threadId))
|
||||
}
|
||||
|
||||
motionEventRelay.setDrain(MotionEventRelayDrain())
|
||||
|
||||
viewModel.updateIdentityRecordsInBackground()
|
||||
}
|
||||
|
||||
@@ -581,7 +581,6 @@ class ConversationFragment :
|
||||
|
||||
viewModel.markLastSeen()
|
||||
|
||||
motionEventRelay.setDrain(null)
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
@@ -870,6 +869,7 @@ class ConversationFragment :
|
||||
val conversationReactionStub = Stub<ConversationReactionOverlay>(binding.conversationReactionScrubberStub)
|
||||
reactionDelegate = ConversationReactionDelegate(conversationReactionStub)
|
||||
reactionDelegate.setOnReactionSelectedListener(OnReactionsSelectedListener())
|
||||
motionEventRelay.setDrain(MotionEventRelayDrain(this))
|
||||
|
||||
voiceMessageRecordingDelegate = VoiceMessageRecordingDelegate(
|
||||
this,
|
||||
@@ -1698,6 +1698,7 @@ class ConversationFragment :
|
||||
onComplete = {
|
||||
if (clearCompose) {
|
||||
composeText.setText("")
|
||||
attachmentManager.clear(GlideApp.with(this@ConversationFragment), false)
|
||||
inputPanel.clearQuote()
|
||||
}
|
||||
|
||||
@@ -3030,9 +3031,15 @@ class ConversationFragment :
|
||||
}
|
||||
}
|
||||
|
||||
private inner class MotionEventRelayDrain : MotionEventRelay.Drain {
|
||||
private inner class MotionEventRelayDrain(lifecycleOwner: LifecycleOwner) : MotionEventRelay.Drain {
|
||||
private val lifecycle = lifecycleOwner.lifecycle
|
||||
|
||||
override fun accept(motionEvent: MotionEvent): Boolean {
|
||||
return reactionDelegate.applyTouchEvent(motionEvent)
|
||||
return if (lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) {
|
||||
reactionDelegate.applyTouchEvent(motionEvent)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3406,7 +3413,7 @@ class ConversationFragment :
|
||||
sendMessage()
|
||||
}
|
||||
|
||||
override fun onEditorAction(v: TextView, actionId: Int, event: KeyEvent): Boolean {
|
||||
override fun onEditorAction(v: TextView, actionId: Int, event: KeyEvent?): Boolean {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEND) {
|
||||
if (inputPanel.isInEditMode) {
|
||||
sendEditButton.performClick()
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.conversation.v2
|
||||
import android.app.Activity
|
||||
import android.view.View
|
||||
import androidx.annotation.ColorRes
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.util.Material3OnScrollHelper
|
||||
import org.thoughtcrime.securesms.wallpaper.ChatWallpaper
|
||||
@@ -13,11 +14,12 @@ import org.thoughtcrime.securesms.wallpaper.ChatWallpaper
|
||||
class ConversationToolbarOnScrollHelper(
|
||||
activity: Activity,
|
||||
toolbarBackground: View,
|
||||
private val wallpaperProvider: () -> ChatWallpaper?
|
||||
private val wallpaperProvider: () -> ChatWallpaper?,
|
||||
lifecycleOwner: LifecycleOwner
|
||||
) : Material3OnScrollHelper(
|
||||
activity,
|
||||
listOf(toolbarBackground),
|
||||
emptyList()
|
||||
activity = activity,
|
||||
views = listOf(toolbarBackground),
|
||||
lifecycleOwner = lifecycleOwner
|
||||
) {
|
||||
override val activeColorSet: ColorSet
|
||||
get() = ColorSet(getActiveToolbarColor(wallpaperProvider() != null))
|
||||
|
||||
@@ -44,6 +44,7 @@ sealed interface ConversationElementKey {
|
||||
private data class MessageBackedKey(val id: Long) : ConversationElementKey {
|
||||
override fun requireMessageId(): Long = id
|
||||
}
|
||||
|
||||
private object ThreadHeaderKey : ConversationElementKey
|
||||
|
||||
/**
|
||||
@@ -107,24 +108,27 @@ class ConversationDataSource(
|
||||
val callHelper = CallHelper()
|
||||
val referencedIds = hashSetOf<ServiceId>()
|
||||
|
||||
MessageTable.mmsReaderFor(SignalDatabase.messages.getConversation(threadId, start.toLong(), length.toLong())).forEach { record ->
|
||||
if (cancellationSignal.isCanceled) {
|
||||
return@forEach
|
||||
}
|
||||
MessageTable.mmsReaderFor(SignalDatabase.messages.getConversation(threadId, start.toLong(), length.toLong()))
|
||||
.use { reader ->
|
||||
reader.forEach { record ->
|
||||
if (cancellationSignal.isCanceled) {
|
||||
return@forEach
|
||||
}
|
||||
|
||||
records.add(record)
|
||||
mentionHelper.add(record)
|
||||
quotedHelper.add(record)
|
||||
reactionHelper.add(record)
|
||||
attachmentHelper.add(record)
|
||||
paymentHelper.add(record)
|
||||
callHelper.add(record)
|
||||
records.add(record)
|
||||
mentionHelper.add(record)
|
||||
quotedHelper.add(record)
|
||||
reactionHelper.add(record)
|
||||
attachmentHelper.add(record)
|
||||
paymentHelper.add(record)
|
||||
callHelper.add(record)
|
||||
|
||||
val updateDescription = record.getUpdateDisplayBody(context, null)
|
||||
if (updateDescription != null) {
|
||||
referencedIds.addAll(updateDescription.mentioned)
|
||||
val updateDescription = record.getUpdateDisplayBody(context, null)
|
||||
if (updateDescription != null) {
|
||||
referencedIds.addAll(updateDescription.mentioned)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (messageRequestData.includeWarningUpdateMessage() && (start + length >= totalSize)) {
|
||||
records.add(NoGroupsInCommon(threadId, messageRequestData.isGroup))
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.mediasend.Media
|
||||
import org.thoughtcrime.securesms.permissions.Permissions
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import java.util.function.Predicate
|
||||
|
||||
/**
|
||||
* Fragment wrapped version of [AttachmentKeyboard] to help encapsulate logic the view
|
||||
@@ -44,6 +45,7 @@ class AttachmentKeyboardFragment : LoggingFragment(R.layout.attachment_keyboard_
|
||||
private lateinit var attachmentKeyboardView: AttachmentKeyboard
|
||||
|
||||
private val lifecycleDisposable = LifecycleDisposable()
|
||||
private val removePaymentFilter: Predicate<AttachmentKeyboardButton> = Predicate { button -> button != AttachmentKeyboardButton.PAYMENT }
|
||||
|
||||
@Suppress("ReplaceGetOrSet")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@@ -51,8 +53,12 @@ class AttachmentKeyboardFragment : LoggingFragment(R.layout.attachment_keyboard_
|
||||
lifecycleDisposable.bindTo(viewLifecycleOwner)
|
||||
|
||||
attachmentKeyboardView = view.findViewById(R.id.attachment_keyboard)
|
||||
|
||||
attachmentKeyboardView.setCallback(this)
|
||||
attachmentKeyboardView.apply {
|
||||
setCallback(this@AttachmentKeyboardFragment)
|
||||
if (!SignalStore.paymentsValues().paymentsAvailability.isSendAllowed) {
|
||||
filterAttachmentKeyboardButtons(removePaymentFilter)
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.getRecentMedia()
|
||||
.subscribeBy {
|
||||
@@ -97,7 +103,7 @@ class AttachmentKeyboardFragment : LoggingFragment(R.layout.attachment_keyboard_
|
||||
) {
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons(null)
|
||||
} else {
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons { button -> button != AttachmentKeyboardButton.PAYMENT }
|
||||
attachmentKeyboardView.filterAttachmentKeyboardButtons(removePaymentFilter)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user