Fix receipt handling issue for stories.
This commit is contained in:
parent
7cc2029cd3
commit
1046265d23
1 changed files with 3 additions and 6 deletions
|
@ -2536,21 +2536,18 @@ public final class MessageContentProcessor {
|
||||||
@NonNull SignalServiceReceiptMessage message,
|
@NonNull SignalServiceReceiptMessage message,
|
||||||
@NonNull Recipient senderRecipient)
|
@NonNull Recipient senderRecipient)
|
||||||
{
|
{
|
||||||
boolean shouldOnlyProcessStories = Stories.isFeatureFlagEnabled() && !SignalStore.storyValues().isFeatureDisabled() && !TextSecurePreferences.isReadReceiptsEnabled(context);
|
if (!TextSecurePreferences.isReadReceiptsEnabled(context)) {
|
||||||
|
|
||||||
if (!TextSecurePreferences.isReadReceiptsEnabled(context) && !shouldOnlyProcessStories) {
|
|
||||||
log("Ignoring viewed receipts for IDs: " + Util.join(message.getTimestamps(), ", "));
|
log("Ignoring viewed receipts for IDs: " + Util.join(message.getTimestamps(), ", "));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log(TAG, "Processing viewed receipts. Sender: " + senderRecipient.getId() + ", Device: " + content.getSenderDevice() + ", Only Stories: " + shouldOnlyProcessStories + ", Timestamps: " + Util.join(message.getTimestamps(), ", "));
|
log(TAG, "Processing viewed receipts. Sender: " + senderRecipient.getId() + ", Device: " + content.getSenderDevice() + ", Timestamps: " + Util.join(message.getTimestamps(), ", "));
|
||||||
|
|
||||||
List<SyncMessageId> ids = Stream.of(message.getTimestamps())
|
List<SyncMessageId> ids = Stream.of(message.getTimestamps())
|
||||||
.map(t -> new SyncMessageId(senderRecipient.getId(), t))
|
.map(t -> new SyncMessageId(senderRecipient.getId(), t))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
Collection<SyncMessageId> unhandled = shouldOnlyProcessStories ? SignalDatabase.mmsSms().incrementViewedStoryReceiptCounts(ids, content.getTimestamp())
|
Collection<SyncMessageId> unhandled = SignalDatabase.mmsSms().incrementViewedReceiptCounts(ids, content.getTimestamp());
|
||||||
: SignalDatabase.mmsSms().incrementViewedReceiptCounts(ids, content.getTimestamp());
|
|
||||||
|
|
||||||
Set<SyncMessageId> handled = new HashSet<>(ids);
|
Set<SyncMessageId> handled = new HashSet<>(ids);
|
||||||
handled.removeAll(unhandled);
|
handled.removeAll(unhandled);
|
||||||
|
|
Loading…
Add table
Reference in a new issue