fix issues

This commit is contained in:
Ryan ZHAO 2020-08-27 14:25:13 +10:00
parent f80e7e169b
commit 3b84448d38
4 changed files with 8 additions and 3 deletions

View File

@ -426,7 +426,9 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
@Override
public void onBindHeaderViewHolder(HeaderViewHolder viewHolder, int position) {
MessageRecord messageRecord = getRecordForPositionOrThrow(position);
viewHolder.setText(DateUtils.getRelativeDate(getContext(), locale, messageRecord.getDateReceived()));
long timestamp = messageRecord.getDateReceived();
if (recipient.getAddress().isOpenGroup()) { timestamp = messageRecord.getTimestamp(); }
viewHolder.setText(DateUtils.getRelativeDate(getContext(), locale, timestamp));
}
public void onBindLastSeenViewHolder(HeaderViewHolder viewHolder, int position) {

View File

@ -844,7 +844,7 @@ public class MmsDatabase extends MessagingDatabase {
// we use current time like a sortId of iOS as the receive time.
// Since the messages has been sorted by server timestamp before they are processed,
// the order here by actual receiving time should be correct.
long receiveTimestamp = System.currentTimeMillis();
long receiveTimestamp = serverTimestamp;
if (serverTimestamp == 0) { receiveTimestamp = retrieved.getSentTimeMillis(); }
contentValues.put(DATE_RECEIVED, receiveTimestamp); // Loki - This is important due to how we handle GIFs
contentValues.put(PART_COUNT, retrieved.getAttachments().size());

View File

@ -629,7 +629,7 @@ public class SmsDatabase extends MessagingDatabase {
// we use current time like a sortId of iOS as the receive time.
// Since the messages has been sorted by server timestamp before they are processed,
// the order here by actual receiving time should be correct.
long receiveTimestamp = System.currentTimeMillis();
long receiveTimestamp = serverTimestamp;
if (serverTimestamp == 0) { receiveTimestamp = message.getSentTimestampMillis(); }
values.put(DATE_RECEIVED, receiveTimestamp); // Loki - This is important due to how we handle GIFs
values.put(DATE_SENT, message.getSentTimestampMillis());

View File

@ -139,6 +139,9 @@ public abstract class MessageRecord extends DisplayRecord {
if (isPush() && getDateSent() < getDateReceived()) {
return getDateSent();
}
if (getRecipient().getAddress().isOpenGroup()) {
return getDateSent();
}
return getDateReceived();
}