mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Wrap thread get/create into a transaction.
This commit is contained in:
@@ -1162,13 +1162,14 @@ class ThreadTable(context: Context, databaseHelper: SignalDatabase) : DatabaseTa
|
||||
}
|
||||
|
||||
fun getOrCreateThreadIdFor(recipient: Recipient, distributionType: Int): Long {
|
||||
val threadId = getThreadIdFor(recipient.id)
|
||||
return threadId ?: createThreadForRecipient(recipient.id, recipient.isGroup, distributionType)
|
||||
return getOrCreateThreadIdFor(recipient.id, recipient.isGroup, distributionType)
|
||||
}
|
||||
|
||||
fun getOrCreateThreadIdFor(recipientId: RecipientId, isGroup: Boolean, distributionType: Int = DistributionTypes.DEFAULT): Long {
|
||||
val threadId = getThreadIdFor(recipientId)
|
||||
return threadId ?: createThreadForRecipient(recipientId, isGroup, distributionType)
|
||||
return writableDatabase.withinTransaction {
|
||||
val threadId = getThreadIdFor(recipientId)
|
||||
threadId ?: createThreadForRecipient(recipientId, isGroup, distributionType)
|
||||
}
|
||||
}
|
||||
|
||||
fun areThreadIdAndRecipientAssociated(threadId: Long, recipient: Recipient): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user