diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationDataSource.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationDataSource.java index 14f1cc58b..fafc60c1a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationDataSource.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationDataSource.java @@ -44,7 +44,7 @@ import java.util.stream.Collectors; /** * Core data source for loading an individual conversation. */ -class ConversationDataSource implements PagedDataSource { +public class ConversationDataSource implements PagedDataSource { private static final String TAG = Log.tag(ConversationDataSource.class); @@ -126,10 +126,10 @@ class ConversationDataSource implements PagedDataSource messageIds = new LinkedList<>(); private Map> messageIdToReactions = new HashMap<>(); @@ -261,11 +261,17 @@ class ConversationDataSource implements PagedDataSource records) { + for (MessageRecord record : records) { + add(record); + } + } + + public void fetchReactions() { messageIdToReactions = SignalDatabase.reactions().getReactionsForMessages(messageIds); } - @NonNull List buildUpdatedModels(@NonNull Context context, @NonNull List records) { + public @NonNull List buildUpdatedModels(@NonNull List records) { return records.stream() .map(record -> { MessageId messageId = new MessageId(record.getId(), record.isMms()); @@ -276,7 +282,7 @@ class ConversationDataSource implements PagedDataSource reactions) { + private static MessageRecord recordWithReactions(@NonNull MessageRecord record, List reactions) { if (Util.hasItems(reactions)) { if (record instanceof MediaMmsMessageRecord) { return ((MediaMmsMessageRecord) record).withReactions(reactions); diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesBottomSheet.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesBottomSheet.kt index bca08b311..0765e3a23 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesBottomSheet.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesBottomSheet.kt @@ -128,7 +128,7 @@ class MessageQuotesBottomSheet : FixedRoundedCornerBottomSheetDialogFragment() { override fun onReactionClicked(multiselectPart: MultiselectPart, messageId: Long, isMms: Boolean) { dismiss() - getAdapterListener().onReactionClicked(multiselectPart, messageId, isMms) + getCallback().jumpToMessage(multiselectPart.conversationMessage.messageRecord) } override fun onGroupMemberClicked(recipientId: RecipientId, groupId: GroupId) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesViewModel.kt index a37f7a39e..4ab661bcc 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/quotes/MessageQuotesViewModel.kt @@ -7,6 +7,7 @@ import androidx.lifecycle.ViewModelProvider import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.core.Observable import io.reactivex.rxjava3.schedulers.Schedulers +import org.thoughtcrime.securesms.conversation.ConversationDataSource import org.thoughtcrime.securesms.conversation.ConversationMessage import org.thoughtcrime.securesms.conversation.colors.GroupAuthorNameColorHelper import org.thoughtcrime.securesms.conversation.colors.NameColor @@ -26,9 +27,13 @@ class MessageQuotesViewModel( fun getMessages(): Observable> { return Observable.create> { emitter -> - val quotes: List = SignalDatabase - .mmsSms - .getAllMessagesThatQuote(messageId) + val records: List = SignalDatabase.mmsSms.getAllMessagesThatQuote(messageId) + + val helper = ConversationDataSource.ReactionHelper() + helper.addAll(records) + helper.fetchReactions() + + val quotes = helper.buildUpdatedModels(records) .map { ConversationMessage.ConversationMessageFactory.createWithUnresolvedData(getApplication(), it) } val originalRecord: MessageRecord? = if (messageId.mms) {