mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-27 22:43:52 +00:00
Collapse KnownRecipient / Story into single model.
This commit is contained in:
committed by
Cody Henthorne
parent
70c6e9e60f
commit
8e313f8387
@@ -51,16 +51,16 @@ class ContactSearchPagedDataSourceTest {
|
||||
|
||||
val expected = listOf(
|
||||
ContactSearchKey.Header(ContactSearchConfiguration.SectionKey.RECENTS),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.Header(ContactSearchConfiguration.SectionKey.INDIVIDUALS)
|
||||
)
|
||||
|
||||
@@ -75,15 +75,15 @@ class ContactSearchPagedDataSourceTest {
|
||||
val result = testSubject.load(5, 10) { false }
|
||||
|
||||
val expected = listOf(
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.Header(ContactSearchConfiguration.SectionKey.INDIVIDUALS),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.KnownRecipient(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, false),
|
||||
ContactSearchKey.Expand(ContactSearchConfiguration.SectionKey.INDIVIDUALS)
|
||||
)
|
||||
|
||||
@@ -99,17 +99,17 @@ class ContactSearchPagedDataSourceTest {
|
||||
|
||||
val expected = listOf(
|
||||
ContactSearchKey.Header(ContactSearchConfiguration.SectionKey.STORIES),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey.Story(RecipientId.UNKNOWN),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
ContactSearchKey.RecipientSearchKey(RecipientId.UNKNOWN, true),
|
||||
)
|
||||
|
||||
val resultKeys = result.map { it.contactSearchKey }
|
||||
|
||||
@@ -108,7 +108,7 @@ class SafetyNumberRepositoryTest {
|
||||
@Test
|
||||
fun batchSafetyNumberCheckSync_batchOf1_noChanges() {
|
||||
val other = recipientPool[1]
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey)))
|
||||
@@ -127,7 +127,7 @@ class SafetyNumberRepositoryTest {
|
||||
val other = recipientPool[1]
|
||||
val otherAci = ACI.from(other.requireServiceId())
|
||||
val otherNewIdentityKey = IdentityKeyUtil.generateIdentityKeyPair().publicKey
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey)))
|
||||
@@ -148,7 +148,7 @@ class SafetyNumberRepositoryTest {
|
||||
val secondOther = recipientPool[2]
|
||||
val otherAci = ACI.from(other.requireServiceId())
|
||||
val otherNewIdentityKey = IdentityKeyUtil.generateIdentityKeyPair().publicKey
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id), ContactSearchKey.RecipientSearchKey.KnownRecipient(secondOther.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false), ContactSearchKey.RecipientSearchKey(secondOther.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other, secondOther))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey, secondOther.requireServiceId() to identityPool[secondOther]!!.identityKey)))
|
||||
@@ -166,7 +166,7 @@ class SafetyNumberRepositoryTest {
|
||||
@Test
|
||||
fun batchSafetyNumberCheckSync_batchOf1_abortOnPriorRecentCheck() {
|
||||
val other = recipientPool[1]
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey)))
|
||||
@@ -187,7 +187,7 @@ class SafetyNumberRepositoryTest {
|
||||
*/
|
||||
@Test
|
||||
fun batchSafetyNumberCheckSync_batchOf10WithSmallBatchSize_noChanges() {
|
||||
val keys = recipientPool.map { ContactSearchKey.RecipientSearchKey.KnownRecipient(it.id) }
|
||||
val keys = recipientPool.map { ContactSearchKey.RecipientSearchKey(it.id, false) }
|
||||
val others = recipientPool.subList(1, recipientPool.lastIndex)
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(others.map { it.id }) }) }.thenReturn(others)
|
||||
@@ -205,7 +205,7 @@ class SafetyNumberRepositoryTest {
|
||||
@Test
|
||||
fun batchSafetyNumberCheckSync_serverError() {
|
||||
val other = recipientPool[1]
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey)))
|
||||
@@ -219,7 +219,7 @@ class SafetyNumberRepositoryTest {
|
||||
@Test
|
||||
fun batchSafetyNumberCheckSync_networkError() {
|
||||
val other = recipientPool[1]
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey)))
|
||||
@@ -233,7 +233,7 @@ class SafetyNumberRepositoryTest {
|
||||
@Test
|
||||
fun batchSafetyNumberCheckSync_badJson() {
|
||||
val other = recipientPool[1]
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey.KnownRecipient(other.id))
|
||||
val keys = listOf(ContactSearchKey.RecipientSearchKey(other.id, false))
|
||||
|
||||
staticRecipient.`when`<List<Recipient>> { Recipient.resolvedList(argThat { containsAll(keys.map { it.recipientId }) }) }.thenReturn(listOf(other))
|
||||
whenever(profileService.performIdentityCheck(mapOf(other.requireServiceId() to identityPool[other]!!.identityKey)))
|
||||
|
||||
Reference in New Issue
Block a user