mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-03 15:05:24 +00:00
Use "date sent" as timestamp for push, "date received" for SMS.
The "sent time" is not reliable on SMS messages. This switches to using "sent time" by default for push messages, but "received time" for SMS messages.
This commit is contained in:
parent
b990202468
commit
d51adab76b
@ -266,7 +266,10 @@ public class ConversationItem extends LinearLayout {
|
|||||||
} else if (messageRecord.isPending()) {
|
} else if (messageRecord.isPending()) {
|
||||||
dateText.setText(" ··· ");
|
dateText.setText(" ··· ");
|
||||||
} else {
|
} else {
|
||||||
final long timestamp = messageRecord.getDateSent();
|
final long timestamp;
|
||||||
|
|
||||||
|
if (messageRecord.isPush()) timestamp = messageRecord.getDateSent();
|
||||||
|
else timestamp = messageRecord.getDateReceived();
|
||||||
|
|
||||||
dateText.setText(DateUtils.getBetterRelativeTimeSpanString(getContext(), timestamp));
|
dateText.setText(DateUtils.getBetterRelativeTimeSpanString(getContext(), timestamp));
|
||||||
}
|
}
|
||||||
|
@ -23,15 +23,14 @@ import android.database.sqlite.SQLiteDatabase;
|
|||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.whispersystems.textsecure.crypto.InvalidMessageException;
|
|
||||||
import org.whispersystems.textsecure.crypto.MasterCipher;
|
|
||||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
|
||||||
import org.thoughtcrime.securesms.database.model.DisplayRecord;
|
import org.thoughtcrime.securesms.database.model.DisplayRecord;
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||||
|
import org.whispersystems.textsecure.crypto.InvalidMessageException;
|
||||||
|
import org.whispersystems.textsecure.crypto.MasterCipher;
|
||||||
import org.whispersystems.textsecure.util.Util;
|
import org.whispersystems.textsecure.util.Util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -379,11 +378,16 @@ public class ThreadDatabase extends Database {
|
|||||||
MmsSmsDatabase.Reader reader = null;
|
MmsSmsDatabase.Reader reader = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
reader = mmsSmsDatabase.readerFor(mmsSmsDatabase.getConversationSnippet(threadId));
|
reader = mmsSmsDatabase.readerFor(mmsSmsDatabase.getConversationSnippet(threadId));
|
||||||
MessageRecord record = null;
|
MessageRecord record;
|
||||||
|
|
||||||
if (reader != null && (record = reader.getNext()) != null) {
|
if (reader != null && (record = reader.getNext()) != null) {
|
||||||
updateThread(threadId, count, record.getBody().getBody(), record.getDateReceived(), record.getType());
|
final long timestamp;
|
||||||
|
|
||||||
|
if (record.isPush()) timestamp = record.getDateSent();
|
||||||
|
else timestamp = record.getDateReceived();
|
||||||
|
|
||||||
|
updateThread(threadId, count, record.getBody().getBody(), timestamp, record.getType());
|
||||||
} else {
|
} else {
|
||||||
deleteThread(threadId);
|
deleteThread(threadId);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user