Add ScheduledMessage to realm schema

This commit is contained in:
Moez Bhatti
2018-06-26 15:28:01 -04:00
parent ad202a2f64
commit 431edfe2ee
5 changed files with 110 additions and 2 deletions
@@ -0,0 +1,14 @@
package com.moez.QKSMS.model
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
open class ScheduledMessage(
@PrimaryKey var id: Long = 0,
var date: Long = 0,
var recipients: RealmList<String> = RealmList(),
var sendAsGroup: Boolean = true,
var body: String = "",
var attachments: RealmList<String> = RealmList()
) : RealmObject()
@@ -0,0 +1,30 @@
package com.moez.QKSMS.repository
import com.moez.QKSMS.model.ScheduledMessage
import io.realm.RealmList
import io.realm.RealmResults
interface ScheduledMessageRepository {
/**
* Saves a scheduled message and returns the id if successful
*/
fun saveScheduledMessage(date: Long, recipients: RealmList<String>, sendAsGroup: Boolean, body: String,
attachments: RealmList<String>): Long
/**
* Returns all of the scheduled messages, sorted chronologically
*/
fun getScheduledMessages(): RealmResults<ScheduledMessage>
/**
* Returns the scheduled message with the given [id]
*/
fun getScheduledMessage(id: Long): ScheduledMessage?
/**
* Deletes the scheduled message with the given [id]
*/
fun deleteScheduledMessage(id: Long)
}