mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-07 15:28:49 +01:00
properly store sent messages in local db
This commit is contained in:
parent
733428da38
commit
e116c5baa8
@ -704,7 +704,13 @@ class ThreadActivity : SimpleActivity() {
|
||||
notificationManager.cancel(threadId.hashCode())
|
||||
}
|
||||
|
||||
val lastMaxId = messages.maxByOrNull { it.id }?.id ?: 0L
|
||||
messages = getMessages(threadId)
|
||||
|
||||
messages.filter { !it.isReceivedMessage() && it.id > lastMaxId }.forEach {
|
||||
messagesDB.insertOrIgnore(it)
|
||||
}
|
||||
|
||||
setupAdapter()
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,9 @@ interface MessagesDao {
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertOrUpdate(message: Message)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
fun insertOrIgnore(message: Message): Long
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
fun insertMessages(vararg message: Message)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user