mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
fix: update last seen if later than current
This commit is contained in:
parent
bd81869f9a
commit
c5299c1010
@ -739,7 +739,10 @@ class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : Messa
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
with (get(context).threadDatabase()) {
|
with (get(context).threadDatabase()) {
|
||||||
setLastSeen(threadId, message.sentTimeMillis)
|
val lastSeen = getLastSeenAndHasSent(threadId).first()
|
||||||
|
if (lastSeen < message.sentTimeMillis) {
|
||||||
|
setLastSeen(threadId, message.sentTimeMillis)
|
||||||
|
}
|
||||||
setHasSent(threadId, true)
|
setHasSent(threadId, true)
|
||||||
if (runThreadUpdate) {
|
if (runThreadUpdate) {
|
||||||
update(threadId, true, true)
|
update(threadId, true, true)
|
||||||
|
@ -564,7 +564,10 @@ public class SmsDatabase extends MessagingDatabase {
|
|||||||
if (runThreadUpdate) {
|
if (runThreadUpdate) {
|
||||||
DatabaseComponent.get(context).threadDatabase().update(threadId, true, true);
|
DatabaseComponent.get(context).threadDatabase().update(threadId, true, true);
|
||||||
}
|
}
|
||||||
DatabaseComponent.get(context).threadDatabase().setLastSeen(threadId, message.getSentTimestampMillis());
|
long lastSeen = DatabaseComponent.get(context).threadDatabase().getLastSeenAndHasSent(threadId).first();
|
||||||
|
if (lastSeen < message.getSentTimestampMillis()) {
|
||||||
|
DatabaseComponent.get(context).threadDatabase().setLastSeen(threadId, message.getSentTimestampMillis());
|
||||||
|
}
|
||||||
|
|
||||||
DatabaseComponent.get(context).threadDatabase().setHasSent(threadId, true);
|
DatabaseComponent.get(context).threadDatabase().setHasSent(threadId, true);
|
||||||
|
|
||||||
|
@ -482,7 +482,9 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
is Conversation.Community -> getThreadIdFor("",null, "${conversation.baseCommunityInfo.baseUrl}.${conversation.baseCommunityInfo.room}", createThread = false)
|
is Conversation.Community -> getThreadIdFor("",null, "${conversation.baseCommunityInfo.baseUrl}.${conversation.baseCommunityInfo.room}", createThread = false)
|
||||||
}
|
}
|
||||||
if (threadId != null) {
|
if (threadId != null) {
|
||||||
markConversationAsRead(threadId, conversation.lastRead)
|
if (conversation.lastRead > getLastSeen(threadId)) {
|
||||||
|
markConversationAsRead(threadId, conversation.lastRead)
|
||||||
|
}
|
||||||
updateThread(threadId, false)
|
updateThread(threadId, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user