mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Collapse KnownRecipient / Story into single model.
This commit is contained in:
committed by
Cody Henthorne
parent
70c6e9e60f
commit
8e313f8387
@@ -99,7 +99,7 @@ object SafetyNumberBottomSheet {
|
||||
fun forIdentityRecordsAndDestinations(identityRecords: List<IdentityRecord>, destinations: List<ContactSearchKey>): Factory {
|
||||
val args = SafetyNumberBottomSheetArgs(
|
||||
identityRecords.map { it.recipientId },
|
||||
destinations.filterIsInstance<ContactSearchKey.RecipientSearchKey>().map { it.requireParcelable() }
|
||||
destinations.filterIsInstance<ContactSearchKey.RecipientSearchKey>().map { it.requireRecipientSearchKey() }
|
||||
)
|
||||
|
||||
return SheetFactory(args)
|
||||
@@ -115,7 +115,7 @@ object SafetyNumberBottomSheet {
|
||||
fun forIdentityRecordsAndDestination(identityRecords: List<IdentityRecord>, destination: ContactSearchKey): Factory {
|
||||
val args = SafetyNumberBottomSheetArgs(
|
||||
identityRecords.map { it.recipientId },
|
||||
listOf(destination).filterIsInstance<ContactSearchKey.RecipientSearchKey>().map { it.requireParcelable() }
|
||||
listOf(destination).filterIsInstance<ContactSearchKey.RecipientSearchKey>().map { it.requireRecipientSearchKey() }
|
||||
)
|
||||
|
||||
return SheetFactory(args)
|
||||
@@ -131,14 +131,14 @@ object SafetyNumberBottomSheet {
|
||||
return args!!
|
||||
}
|
||||
|
||||
private fun getDestinationFromRecord(messageRecord: MessageRecord): List<ContactSearchKey.ParcelableRecipientSearchKey> {
|
||||
private fun getDestinationFromRecord(messageRecord: MessageRecord): List<ContactSearchKey.RecipientSearchKey> {
|
||||
val key = if ((messageRecord as? MmsMessageRecord)?.storyType?.isStory == true) {
|
||||
ContactSearchKey.RecipientSearchKey.Story(messageRecord.recipient.id)
|
||||
ContactSearchKey.RecipientSearchKey(messageRecord.recipient.id, true)
|
||||
} else {
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(messageRecord.recipient.id)
|
||||
ContactSearchKey.RecipientSearchKey(messageRecord.recipient.id, false)
|
||||
}
|
||||
|
||||
return listOf(key.requireParcelable())
|
||||
return listOf(key)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,6 @@ import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
@Parcelize
|
||||
data class SafetyNumberBottomSheetArgs(
|
||||
val untrustedRecipients: List<RecipientId>,
|
||||
val destinations: List<ContactSearchKey.ParcelableRecipientSearchKey>,
|
||||
val destinations: List<ContactSearchKey.RecipientSearchKey>,
|
||||
val messageId: MessageId? = null
|
||||
) : Parcelable
|
||||
|
||||
@@ -25,7 +25,7 @@ class SafetyNumberBottomSheetViewModel(
|
||||
private const val MAX_RECIPIENTS_TO_DISPLAY = 5
|
||||
}
|
||||
|
||||
private val destinationStore = RxStore(args.destinations.map { it.asRecipientSearchKey() })
|
||||
private val destinationStore = RxStore(args.destinations)
|
||||
val destinationSnapshot: List<ContactSearchKey.RecipientSearchKey>
|
||||
get() = destinationStore.state
|
||||
|
||||
|
||||
Reference in New Issue
Block a user