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
This commit is contained in:
Asiel Díaz Benítez
2022-09-16 03:54:01 -04:00
committed by GitHub
parent 5261d53412
commit 1252b862d8
@@ -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);
}
}