mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-18 20:08:53 +01:00
Swipe to archive (#5)
This commit is contained in:
@@ -8,6 +8,7 @@ open class Conversation : RealmObject() {
|
||||
|
||||
@PrimaryKey var id: Long = 0
|
||||
var contacts: RealmList<Contact> = RealmList()
|
||||
var archived: Boolean = false
|
||||
|
||||
fun getTitle(): String {
|
||||
var title = ""
|
||||
|
||||
@@ -62,6 +62,17 @@ class MessageRepository @Inject constructor(
|
||||
.findAllSorted("date")
|
||||
}
|
||||
|
||||
fun markArchived(threadId: Long) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val conversation = realm.where(Conversation::class.java)
|
||||
.equalTo("id", threadId)
|
||||
.equalTo("archived", false)
|
||||
.findFirst()
|
||||
|
||||
conversation?.archived = true
|
||||
realm.close()
|
||||
}
|
||||
|
||||
fun markAllSeen() {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val messages = realm.where(Message::class.java).equalTo("seen", false).findAll()
|
||||
|
||||
Reference in New Issue
Block a user