From 1252b862d84d1f560102eb5b740ebea2918e2db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asiel=20D=C3=ADaz=20Ben=C3=ADtez?= Date: Fri, 16 Sep 2022 03:54:01 -0400 Subject: [PATCH] load contact from database before calling wasSeenRecently() (#2382) * load contact from database before calling wasSeenRecently() in ConversationActivity.handleEvent() * add a comment about why handling DC_EVENT_MSG_DELIVERED is needed --- src/org/thoughtcrime/securesms/ConversationActivity.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/ConversationActivity.java b/src/org/thoughtcrime/securesms/ConversationActivity.java index 795045d89..b249340e6 100644 --- a/src/org/thoughtcrime/securesms/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/ConversationActivity.java @@ -270,8 +270,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity if (!isMultiUser()) { eventCenter.addObserver(DcContext.DC_EVENT_INCOMING_MSG, this); - eventCenter.addObserver(DcContext.DC_EVENT_MSG_DELIVERED, this); eventCenter.addObserver(DcContext.DC_EVENT_MSG_READ, this); + // handle DC_EVENT_MSG_DELIVERED to hide the seen-recently indicator if needed: + eventCenter.addObserver(DcContext.DC_EVENT_MSG_DELIVERED, this); } if (isForwarding(this)) { @@ -1580,7 +1581,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity || eventId == DcContext.DC_EVENT_MSG_DELIVERED) && event.getData1Int() == chatId) { DcContact contact = recipient.getDcContact(); - titleView.setSeenRecently(contact!=null? contact.wasSeenRecently() : false); + titleView.setSeenRecently(contact!=null? dcContext.getContact(contact.getId()).wasSeenRecently() : false); } }