mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
Move to quoted message on quote preview click.
This commit is contained in:
@@ -220,6 +220,9 @@ public class InputPanel extends ConstraintLayout
|
|||||||
@NonNull QuoteModel.Type quoteType)
|
@NonNull QuoteModel.Type quoteType)
|
||||||
{
|
{
|
||||||
this.quoteView.setQuote(requestManager, id, author, body, false, attachments, null, quoteType);
|
this.quoteView.setQuote(requestManager, id, author, body, false, attachments, null, quoteType);
|
||||||
|
if (listener != null) {
|
||||||
|
this.quoteView.setOnClickListener(v -> listener.onQuoteClicked(id, author.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight()
|
int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight()
|
||||||
: 0;
|
: 0;
|
||||||
@@ -817,6 +820,7 @@ public class InputPanel extends ConstraintLayout
|
|||||||
void onStickerSuggestionSelected(@NonNull StickerRecord sticker);
|
void onStickerSuggestionSelected(@NonNull StickerRecord sticker);
|
||||||
void onQuoteChanged(long id, @NonNull RecipientId author);
|
void onQuoteChanged(long id, @NonNull RecipientId author);
|
||||||
void onQuoteCleared();
|
void onQuoteCleared();
|
||||||
|
void onQuoteClicked(long quoteId, RecipientId authorId);
|
||||||
void onEnterEditMode();
|
void onEnterEditMode();
|
||||||
void onExitEditMode();
|
void onExitEditMode();
|
||||||
void onQuickCameraToggleClicked();
|
void onQuickCameraToggleClicked();
|
||||||
|
|||||||
@@ -2755,6 +2755,17 @@ class ConversationFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun handleMoveToQuotePosition(quoteId: Long, authorId: RecipientId) {
|
||||||
|
disposables += viewModel.getQuotedMessagePosition(quoteId, authorId)
|
||||||
|
.subscribeBy {
|
||||||
|
if (it >= 0) {
|
||||||
|
moveToPosition(it)
|
||||||
|
} else {
|
||||||
|
toast(R.string.ConversationFragment_quoted_message_no_longer_available)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//endregion Scroll Handling
|
//endregion Scroll Handling
|
||||||
|
|
||||||
// region Conversation Callbacks
|
// region Conversation Callbacks
|
||||||
@@ -2788,14 +2799,7 @@ class ConversationFragment :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
disposables += viewModel.getQuotedMessagePosition(quote)
|
handleMoveToQuotePosition(quote.id, quote.author)
|
||||||
.subscribeBy {
|
|
||||||
if (it >= 0) {
|
|
||||||
moveToPosition(it)
|
|
||||||
} else {
|
|
||||||
toast(R.string.ConversationFragment_quoted_message_no_longer_available)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLinkPreviewClicked(linkPreview: LinkPreview) {
|
override fun onLinkPreviewClicked(linkPreview: LinkPreview) {
|
||||||
@@ -4219,6 +4223,10 @@ class ConversationFragment :
|
|||||||
draftViewModel.clearQuoteDraft()
|
draftViewModel.clearQuoteDraft()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onQuoteClicked(quoteId: Long, authorId: RecipientId) {
|
||||||
|
handleMoveToQuotePosition(quoteId = quoteId, authorId = authorId)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onEnterEditMode() {
|
override fun onEnterEditMode() {
|
||||||
updateToggleButtonState()
|
updateToggleButtonState()
|
||||||
previousPage = keyboardPagerViewModel.page().value
|
previousPage = keyboardPagerViewModel.page().value
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ import org.thoughtcrime.securesms.database.model.Mention
|
|||||||
import org.thoughtcrime.securesms.database.model.MessageId
|
import org.thoughtcrime.securesms.database.model.MessageId
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
||||||
import org.thoughtcrime.securesms.database.model.Quote
|
|
||||||
import org.thoughtcrime.securesms.database.model.ReactionRecord
|
import org.thoughtcrime.securesms.database.model.ReactionRecord
|
||||||
import org.thoughtcrime.securesms.database.model.StickerRecord
|
import org.thoughtcrime.securesms.database.model.StickerRecord
|
||||||
import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList
|
import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList
|
||||||
@@ -249,9 +248,9 @@ class ConversationRepository(
|
|||||||
oldConversationRepository.markGiftBadgeRevealed(messageId)
|
oldConversationRepository.markGiftBadgeRevealed(messageId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getQuotedMessagePosition(threadId: Long, quote: Quote): Single<Int> {
|
fun getQuotedMessagePosition(threadId: Long, quoteId: Long, authorId: RecipientId): Single<Int> {
|
||||||
return Single.fromCallable {
|
return Single.fromCallable {
|
||||||
SignalDatabase.messages.getQuotedMessagePosition(threadId, quote.id, quote.author)
|
SignalDatabase.messages.getQuotedMessagePosition(threadId, quoteId, authorId)
|
||||||
}.subscribeOn(Schedulers.io())
|
}.subscribeOn(Schedulers.io())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ import org.thoughtcrime.securesms.database.model.Mention
|
|||||||
import org.thoughtcrime.securesms.database.model.MessageId
|
import org.thoughtcrime.securesms.database.model.MessageId
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord
|
import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||||
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
import org.thoughtcrime.securesms.database.model.MmsMessageRecord
|
||||||
import org.thoughtcrime.securesms.database.model.Quote
|
|
||||||
import org.thoughtcrime.securesms.database.model.ReactionRecord
|
import org.thoughtcrime.securesms.database.model.ReactionRecord
|
||||||
import org.thoughtcrime.securesms.database.model.StickerRecord
|
import org.thoughtcrime.securesms.database.model.StickerRecord
|
||||||
import org.thoughtcrime.securesms.database.model.StoryViewState
|
import org.thoughtcrime.securesms.database.model.StoryViewState
|
||||||
@@ -404,8 +403,8 @@ class ConversationViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getQuotedMessagePosition(quote: Quote): Single<Int> {
|
fun getQuotedMessagePosition(quoteId: Long, authorId: RecipientId): Single<Int> {
|
||||||
return repository.getQuotedMessagePosition(threadId, quote)
|
return repository.getQuotedMessagePosition(threadId, quoteId, authorId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun moveToDate(receivedTimestamp: Long): Single<Int> {
|
fun moveToDate(receivedTimestamp: Long): Single<Int> {
|
||||||
|
|||||||
Reference in New Issue
Block a user