diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationAdapter.java b/src/org/thoughtcrime/securesms/conversation/ConversationAdapter.java index 0182fde11e..64e7365b1d 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationAdapter.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationAdapter.java @@ -426,7 +426,9 @@ public class ConversationAdapter @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) { diff --git a/src/org/thoughtcrime/securesms/database/MmsDatabase.java b/src/org/thoughtcrime/securesms/database/MmsDatabase.java index ba2c74da47..4ef30d33eb 100644 --- a/src/org/thoughtcrime/securesms/database/MmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/MmsDatabase.java @@ -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()); diff --git a/src/org/thoughtcrime/securesms/database/SmsDatabase.java b/src/org/thoughtcrime/securesms/database/SmsDatabase.java index d75b5346b1..aa9aeabdaf 100644 --- a/src/org/thoughtcrime/securesms/database/SmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/SmsDatabase.java @@ -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()); diff --git a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java index 2e54b9d65e..effea38c60 100644 --- a/src/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/src/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -139,6 +139,9 @@ public abstract class MessageRecord extends DisplayRecord { if (isPush() && getDateSent() < getDateReceived()) { return getDateSent(); } + if (getRecipient().getAddress().isOpenGroup()) { + return getDateSent(); + } return getDateReceived(); }