kopia lustrzana https://github.com/ryukoposting/Signal-Android
56 wiersze
1.3 KiB
Kotlin
56 wiersze
1.3 KiB
Kotlin
|
package org.thoughtcrime.securesms.database
|
||
|
|
||
|
import org.thoughtcrime.securesms.database.model.StoryType
|
||
|
import org.thoughtcrime.securesms.mms.OutgoingMediaMessage
|
||
|
import org.thoughtcrime.securesms.recipients.Recipient
|
||
|
|
||
|
/**
|
||
|
* Helper methods for inserting an MMS message into the MMS table.
|
||
|
*/
|
||
|
object MmsHelper {
|
||
|
|
||
|
fun insert(
|
||
|
recipient: Recipient = Recipient.UNKNOWN,
|
||
|
body: String = "body",
|
||
|
sentTimeMillis: Long = System.currentTimeMillis(),
|
||
|
subscriptionId: Int = -1,
|
||
|
expiresIn: Long = 0,
|
||
|
viewOnce: Boolean = false,
|
||
|
distributionType: Int = ThreadDatabase.DistributionTypes.DEFAULT,
|
||
|
threadId: Long = 1,
|
||
|
storyType: StoryType = StoryType.NONE
|
||
|
): Long {
|
||
|
val message = OutgoingMediaMessage(
|
||
|
recipient,
|
||
|
body,
|
||
|
emptyList(),
|
||
|
sentTimeMillis,
|
||
|
subscriptionId,
|
||
|
expiresIn,
|
||
|
viewOnce,
|
||
|
distributionType,
|
||
|
storyType,
|
||
|
null,
|
||
|
false,
|
||
|
null,
|
||
|
emptyList(),
|
||
|
emptyList(),
|
||
|
emptyList(),
|
||
|
emptySet(),
|
||
|
emptySet()
|
||
|
)
|
||
|
|
||
|
return insert(
|
||
|
message = message,
|
||
|
threadId = threadId,
|
||
|
)
|
||
|
}
|
||
|
|
||
|
fun insert(
|
||
|
message: OutgoingMediaMessage,
|
||
|
threadId: Long
|
||
|
): Long {
|
||
|
return SignalDatabase.mms.insertMessageOutbox(message, threadId, false, GroupReceiptDatabase.STATUS_UNKNOWN, null)
|
||
|
}
|
||
|
}
|