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