Indicate in UI when scheduled messages are present

Added a new property to scheduled messages to save which conversation the scheduled message belongs to.
This commit is contained in:
Inhishonor
2025-07-08 18:22:07 -07:00
parent 56a767bbd7
commit 3d7526512d
19 changed files with 146 additions and 18 deletions
@@ -41,7 +41,8 @@ class AddScheduledMessage @Inject constructor(
val recipients: List<String>,
val sendAsGroup: Boolean,
val body: String,
val attachments: List<String>
val attachments: List<String>,
val conversationId: Long
)
@SuppressLint("Range")
@@ -50,7 +51,13 @@ class AddScheduledMessage @Inject constructor(
return Flowable.just(params)
.map { // step 1 - save, as-is, to db to get primary key id
scheduledMessageRepo.saveScheduledMessage(
it.date, it.subId, it.recipients, it.sendAsGroup, it.body, it.attachments
it.date,
it.subId,
it.recipients,
it.sendAsGroup,
it.body,
it.attachments,
it.conversationId
)
}
.map { scheduledMessageDb ->
@@ -29,7 +29,8 @@ open class ScheduledMessage(
var recipients: RealmList<String> = RealmList(),
var sendAsGroup: Boolean = true,
var body: String = "",
var attachments: RealmList<String> = RealmList()
var attachments: RealmList<String> = RealmList(),
var conversationId: Long = 0
) : RealmObject() {
fun copy(
@@ -39,10 +40,11 @@ open class ScheduledMessage(
recipients: RealmList<String> = this.recipients,
sendAsGroup: Boolean = this.sendAsGroup,
body: String = this.body,
attachments: RealmList<String> = this.attachments
attachments: RealmList<String> = this.attachments,
conversationId: Long = this.conversationId
): ScheduledMessage {
return ScheduledMessage(id, date, subId, recipients, sendAsGroup, body, attachments)
return ScheduledMessage(id, date, subId, recipients, sendAsGroup, body, attachments, conversationId)
}
}
@@ -18,7 +18,9 @@
*/
package dev.octoshrimpy.quik.repository
import dev.octoshrimpy.quik.model.Recipient
import dev.octoshrimpy.quik.model.ScheduledMessage
import io.realm.RealmList
import io.realm.RealmResults
interface ScheduledMessageRepository {
@@ -32,7 +34,8 @@ interface ScheduledMessageRepository {
recipients: List<String>,
sendAsGroup: Boolean,
body: String,
attachments: List<String>
attachments: List<String>,
conversationId: Long
): ScheduledMessage
/**
@@ -50,6 +53,11 @@ interface ScheduledMessageRepository {
*/
fun getScheduledMessage(id: Long): ScheduledMessage?
/**
* Returns all scheduled messages with the given [conversationId]
*/
fun getScheduledMessagesForConversation(conversationId: Long): RealmResults<ScheduledMessage>
/**
* Deletes the scheduled message with the given [id]
*/