Add lastTimeUsed value in ContactEmail data model to sort recipients by

it

MAILAND-2241
This commit is contained in:
Zorica Stojchevska 2021-12-08 14:37:13 +01:00 committed by Zorica Stojchevska
parent 1100044aaf
commit ea3a04cb74
16 changed files with 154 additions and 65 deletions

View File

@ -21,6 +21,7 @@ package ch.protonmail.android.api.models.room.contacts
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.test.InstrumentationRegistry
import ch.protonmail.android.api.models.ContactEncryptedData
import ch.protonmail.android.api.models.MessageRecipient
import ch.protonmail.android.api.models.room.testValue
import ch.protonmail.android.core.Constants
import ch.protonmail.android.data.local.ContactDao
@ -60,35 +61,40 @@ internal class ContactDaoTest {
email = "a@a.com",
contactId = "aa",
labelIds = listOf("aaa", "aaaa", "aaaaa"),
name = "ce1"
name = "ce1",
lastUsedTime = "111"
),
ContactEmail(
contactEmailId = "b",
email = "b@b.com",
contactId = "bb",
labelIds = listOf("bbb", "bbbb", "bbbbb"),
name = "ce2"
name = "ce2",
lastUsedTime = "113"
),
ContactEmail(
contactEmailId = "c",
email = "c@c.com",
contactId = "bb",
labelIds = listOf("ccc", "cccc", "ccccc"),
name = "ce3"
name = "ce3",
lastUsedTime = "115"
),
ContactEmail(
contactEmailId = "d",
email = "b@b.com",
contactId = "dd",
labelIds = listOf("ddd", "dddd", "ddddd"),
name = "ce4"
name = "ce4",
lastUsedTime = "114"
),
ContactEmail(
contactEmailId = "e",
email = "e@e.com",
contactId = "ee",
labelIds = listOf("eee", "eeee", "eeeee"),
name = "ce5"
name = "ce5",
lastUsedTime = "112"
)
)
@ -308,6 +314,23 @@ internal class ContactDaoTest {
assertDatabaseState()
}
@Test
fun findAllMessageRecipients() {
// given
val expected = contactEmails
.sortedByDescending { it.lastUsedTime }
.map { contactEmail ->
MessageRecipient(contactData.find { it.contactId == contactEmail.contactId }?.name, contactEmail.email)
}.toSet()
// when
val actual = database.findAllMessageRecipients().blockingFirst().toSet()
// then
Assert.assertEquals(expected, actual)
assertDatabaseState()
}
@Test
fun clearByEmail() {
val deletedEmail = contactEmails[1].email
@ -346,7 +369,8 @@ internal class ContactDaoTest {
"z@z.com",
contactId = "zzz",
labelIds = listOf("zzzz", "zzzzz", "zzzzzz"),
name = "ce1"
name = "ce1",
lastUsedTime = "116"
)
val expected = contactEmails + inserted
database.saveContactEmail(inserted)
@ -361,14 +385,16 @@ internal class ContactDaoTest {
"y@y.com",
contactId = "yyy",
labelIds = listOf("yyyy", "yyyyy", "yyyyyy"),
name = "ce1"
name = "ce1",
lastUsedTime = "118"
),
ContactEmail(
"z",
"z@z.com",
contactId = "zzz",
labelIds = listOf("zzzz", "zzzzz", "zzzzzz"),
name = "ce2"
name = "ce2",
lastUsedTime = "116"
)
)
val expected = contactEmails + inserted
@ -384,14 +410,16 @@ internal class ContactDaoTest {
"y@y.com",
contactId = "yyy",
labelIds = listOf("yyyy", "yyyyy", "yyyyyy"),
name = "ce1"
name = "ce1",
lastUsedTime = "118"
),
ContactEmail(
"z",
"z@z.com",
contactId = "zzz",
labelIds = listOf("zzzz", "zzzzz", "zzzzzz"),
name = "ce2"
name = "ce2",
lastUsedTime = "116"
)
)
val expected = contactEmails + inserted
@ -452,19 +480,22 @@ internal class ContactDaoTest {
"e1",
"1@1.1",
"a",
labelIds = listOf("la", "lc")
labelIds = listOf("la", "lc"),
lastUsedTime = "121"
)
val email2 = ContactEmail(
"e2",
"2@2.2",
"b",
labelIds = listOf("la", "lc")
labelIds = listOf("la", "lc"),
lastUsedTime = "123"
)
val email3 = ContactEmail(
"e3",
"3@3.3",
"c",
labelIds = listOf("la", "lc")
labelIds = listOf("la", "lc"),
lastUsedTime = "122"
)
initiallyEmptyDatabase.saveAllContactsEmails(listOf(email1, email2, email3))
val emailFromDb = initiallyEmptyDatabase.findContactEmailById("e1")

View File

@ -49,10 +49,6 @@ interface ContactService {
@Headers(CONTENT_TYPE, ACCEPT_HEADER_V1)
suspend fun contacts(@Query("Page") page: Int, @Query("PageSize") pageSize: Int): ContactsDataResponse
@GET("contacts/emails")
@Headers(CONTENT_TYPE, ACCEPT_HEADER_V1)
fun contactsEmailsCall(@Query("Page") page: Int, @Query("PageSize") pageSize: Int): Call<ContactEmailsResponseV2>
@GET("contacts/emails")
@Headers(CONTENT_TYPE, ACCEPT_HEADER_V1)
suspend fun contactsEmails(@Query("Page") page: Int, @Query("PageSize") pageSize: Int): ContactEmailsResponseV2

View File

@ -406,7 +406,7 @@ public class EditContactDetailsActivity extends BaseConnectivityActivity {
}
if (!TextUtils.isEmpty(optionValue)) {
emailsToBeRemoved.add(optionValue);
emails.add(new ContactEmail(viewModel.getContactId(), optionValue, contactName));
emails.add(new ContactEmail(viewModel.getContactId(), optionValue, contactName, ""));
Email vCardEmail = new Email(optionValue);
if (!TextUtils.isEmpty(optionType)) {
EmailType emailType = EmailType.find(optionType);

View File

@ -33,6 +33,7 @@ import ch.protonmail.android.data.local.model.COLUMN_CONTACT_EMAILS_CONTACT_ID
import ch.protonmail.android.data.local.model.COLUMN_CONTACT_EMAILS_EMAIL
import ch.protonmail.android.data.local.model.COLUMN_CONTACT_EMAILS_ID
import ch.protonmail.android.data.local.model.COLUMN_CONTACT_EMAILS_LABEL_IDS
import ch.protonmail.android.data.local.model.COLUMN_CONTACT_EMAILS_LAST_TIME_USED
import ch.protonmail.android.data.local.model.COLUMN_CONTACT_ID
import ch.protonmail.android.data.local.model.ContactData
import ch.protonmail.android.data.local.model.ContactEmail
@ -139,6 +140,7 @@ interface ContactDao {
FROM $TABLE_CONTACT_DATA
JOIN $TABLE_CONTACT_EMAILS
ON $TABLE_CONTACT_DATA.$COLUMN_CONTACT_DATA_ID = $TABLE_CONTACT_EMAILS.$COLUMN_CONTACT_EMAILS_CONTACT_ID
ORDER BY $COLUMN_CONTACT_EMAILS_LAST_TIME_USED COLLATE NOCASE DESC
"""
)
fun findAllMessageRecipients(): Flowable<List<MessageRecipient>>

View File

@ -40,7 +40,7 @@ import org.apache.commons.lang3.StringEscapeUtils
ContactEmail::class,
FullContactDetails::class,
],
version = 2
version = 3
)
@TypeConverters(
FullContactDetailsConverter::class,

View File

@ -38,6 +38,7 @@ const val COLUMN_CONTACT_EMAILS_ORDER = "Order"
const val COLUMN_CONTACT_EMAILS_CONTACT_ID = "ContactID"
const val COLUMN_CONTACT_EMAILS_LABEL_IDS = "LabelIDs"
const val COLUMN_CONTACT_EMAILS_DEFAULTS = "Defaults"
const val COLUMN_CONTACT_EMAILS_LAST_TIME_USED = "LastUsedTime"
@Entity(
tableName = TABLE_CONTACT_EMAILS,
@ -81,7 +82,11 @@ data class ContactEmail @JvmOverloads constructor(
@SerializedName(COLUMN_CONTACT_EMAILS_LABEL_IDS)
@ColumnInfo(name = COLUMN_CONTACT_EMAILS_LABEL_IDS)
var labelIds: List<String>? = null
var labelIds: List<String>? = null,
@SerializedName(COLUMN_CONTACT_EMAILS_LAST_TIME_USED)
@ColumnInfo(name = COLUMN_CONTACT_EMAILS_LAST_TIME_USED)
val lastUsedTime: String
) : Serializable {

View File

@ -290,7 +290,7 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
}
)
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("contactId", "anotherContact@pm.me", "anotherContactName"))
listOf(ContactEmail("contactId", "anotherContact@pm.me", "anotherContactName", lastUsedTime = "111"))
)
val expected = MailboxUiItem(
@ -340,7 +340,7 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
coEvery {
contactsRepository.findContactsByEmail(match { emails -> emails.contains(senderEmailAddress) })
} returns flowOf(
listOf(ContactEmail("contactId", senderEmailAddress, contactName))
listOf(ContactEmail("contactId", senderEmailAddress, contactName, lastUsedTime = "111"))
)
every { conversationModeEnabled(any()) } returns false
@ -481,7 +481,7 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
coEvery {
contactsRepository.findContactsByEmail(match { emails -> emails.contains(recipientEmailAddress) })
} returns flowOf(
listOf(ContactEmail("contactId", recipientEmailAddress, contactName))
listOf(ContactEmail("contactId", recipientEmailAddress, contactName, lastUsedTime = "111"))
)
every { conversationModeEnabled(any()) } returns false
@ -695,7 +695,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
)
val successResult = GetConversationsResult.Success(listOf(conversation))
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLocation(location)
@ -746,7 +750,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
val successResult = GetConversationsResult.Success(listOf(conversation))
val labelId = "labelId923842"
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLocation(location)
@ -793,7 +801,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
)
val successResult = GetConversationsResult.Success(listOf(conversation))
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLocation(location)
@ -845,7 +857,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
)
val successResult = GetConversationsResult.Success(listOf(conversation))
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLocation(location)
@ -900,7 +916,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
)
val successResult = GetConversationsResult.Success(listOf(conversation))
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLabel(customLabelId)
@ -951,7 +971,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
)
val successResult = GetConversationsResult.Success(listOf(conversation))
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLocation(location)
@ -1003,7 +1027,11 @@ class MailboxViewModelTest : ArchTest, CoroutinesTest {
)
val successResult = GetConversationsResult.Success(listOf(conversation))
coEvery { contactsRepository.findAllContactEmails() } returns flowOf(
listOf(ContactEmail("firstContactId", "firstsender@protonmail.com", "firstContactName"))
listOf(
ContactEmail(
"firstContactId", "firstsender@protonmail.com", "firstContactName", lastUsedTime = "111"
)
)
)
viewModel.setNewMailboxLocation(location)

View File

@ -135,7 +135,10 @@ class MessageDetailsViewModelTest : ArchTest, CoroutinesTest {
private val labelRepository: LabelRepository = mockk(relaxed = true)
private val testSenderContactEmail = ContactEmail(
"defaultMockContactEmailId", "defaultMockContactEmailAddress", "defaultMockContactName"
"defaultMockContactEmailId",
"defaultMockContactEmailAddress",
"defaultMockContactName",
lastUsedTime = "111"
)
private val contactsRepository: ContactsRepository = mockk {
coEvery { findContactEmailByEmail(any()) } returns testSenderContactEmail

View File

@ -123,7 +123,8 @@ class ContactEmailsManagerTest : CoroutinesTest, ArchTest {
)
val contactEmailId = "emailId1"
val labelIds = listOf(labelId1)
val contactEmail = ContactEmail(contactEmailId, "test1@abc.com", "name1", labelIds = labelIds)
val contactEmail =
ContactEmail(contactEmailId, "test1@abc.com", "name1", labelIds = labelIds, lastUsedTime = "111")
val newContactEmails = listOf(contactEmail)
coEvery { api.getContactGroups(testUserId) } returns apiResult
val emailsResponse = mockk<ContactEmailsResponseV2> {
@ -181,11 +182,16 @@ class ContactEmailsManagerTest : CoroutinesTest, ArchTest {
val contactEmailId4 = "emailId4"
val contactEmailId5 = "emailId5"
val labelIds = listOf(labelId1)
val contactEmail1 = ContactEmail(contactEmailId1, "test1@abc.com", "name1", labelIds = labelIds)
val contactEmail2 = ContactEmail(contactEmailId2, "test2@abc.com", "name2", labelIds = labelIds)
val contactEmail3 = ContactEmail(contactEmailId3, "test3@abc.com", "name3", labelIds = labelIds)
val contactEmail4 = ContactEmail(contactEmailId4, "test4@abc.com", "name4", labelIds = labelIds)
val contactEmail5 = ContactEmail(contactEmailId5, "test5@abc.com", "name5", labelIds = labelIds)
val contactEmail1 =
ContactEmail(contactEmailId1, "test1@abc.com", "name1", labelIds = labelIds, lastUsedTime = "111")
val contactEmail2 =
ContactEmail(contactEmailId2, "test2@abc.com", "name2", labelIds = labelIds, lastUsedTime = "113")
val contactEmail3 =
ContactEmail(contactEmailId3, "test3@abc.com", "name3", labelIds = labelIds, lastUsedTime = "115")
val contactEmail4 =
ContactEmail(contactEmailId4, "test4@abc.com", "name4", labelIds = labelIds, lastUsedTime = "114")
val contactEmail5 =
ContactEmail(contactEmailId5, "test5@abc.com", "name5", labelIds = labelIds, lastUsedTime = "112")
val newContactEmails1 = listOf(contactEmail1, contactEmail2)
val newContactEmails2 = listOf(contactEmail3, contactEmail4)
val newContactEmails3 = listOf(contactEmail5)

View File

@ -74,8 +74,8 @@ class ContactDetailsRepositoryTest {
fun saveContactEmailsSavesAllTheContactEmailsToContactsDb() {
runBlockingTest {
val emails = listOf(
ContactEmail("ID1", "email@proton.com", "Tom"),
ContactEmail("ID2", "secondary@proton.com", "Mike")
ContactEmail("ID1", "email@proton.com", "Tom", lastUsedTime = "111"),
ContactEmail("ID2", "secondary@proton.com", "Mike", lastUsedTime = "112")
)
repository.saveContactEmails(emails)
@ -105,12 +105,12 @@ class ContactDetailsRepositoryTest {
runBlockingTest {
val contactId = "contactId"
val localContactEmails = listOf(
ContactEmail("ID1", "email@proton.com", "Tom"),
ContactEmail("ID2", "secondary@proton.com", "Mike")
ContactEmail("ID1", "email@proton.com", "Tom", lastUsedTime = "111"),
ContactEmail("ID2", "secondary@proton.com", "Mike", lastUsedTime = "112")
)
val serverEmails = listOf(
ContactEmail("ID3", "martin@proton.com", "Martin"),
ContactEmail("ID4", "kent@proton.com", "kent")
ContactEmail("ID3", "martin@proton.com", "Martin", lastUsedTime = "111"),
ContactEmail("ID4", "kent@proton.com", "kent", lastUsedTime = "112")
)
coEvery { contactDao.findContactEmailsByContactId(contactId) } returns localContactEmails

View File

@ -56,8 +56,10 @@ class FetchContactGroupsTest : ArchTest, CoroutinesTest {
val labelId1 = LabelId("labelId1")
val labelId2 = LabelId("labelId2")
val labelIds = listOf(labelId1.id)
val contactEmail1 = ContactEmail(contactEmailId1, "test1@abc.com", "name1", labelIds = labelIds)
val contactEmail2 = ContactEmail(contactEmailId2, "test2@abc.com", "name1", labelIds = labelIds)
val contactEmail1 =
ContactEmail(contactEmailId1, "test1@abc.com", "name1", labelIds = labelIds, lastUsedTime = "111")
val contactEmail2 =
ContactEmail(contactEmailId2, "test2@abc.com", "name1", labelIds = labelIds, lastUsedTime = "112")
val list1 = listOf(contactEmail1, contactEmail2)
val contactLabel1 =
Label(
@ -93,9 +95,12 @@ class FetchContactGroupsTest : ArchTest, CoroutinesTest {
val labelId2 = LabelId("labelId2")
val labelId3 = LabelId("labelId3")
val labelIds = listOf(labelId1.id)
val contactEmail1 = ContactEmail(contactEmailId1, "test1@abc.com", "name1", labelIds = labelIds)
val contactEmail2 = ContactEmail(contactEmailId2, "test2@abc.com", "name2", labelIds = labelIds)
val contactEmail3 = ContactEmail(contactEmailId3, "test3@abc.com", "name3", labelIds = labelIds)
val contactEmail1 =
ContactEmail(contactEmailId1, "test1@abc.com", "name1", labelIds = labelIds, lastUsedTime = "111")
val contactEmail2 =
ContactEmail(contactEmailId2, "test2@abc.com", "name2", labelIds = labelIds, lastUsedTime = "113")
val contactEmail3 =
ContactEmail(contactEmailId3, "test3@abc.com", "name3", labelIds = labelIds, lastUsedTime = "112")
val list1 = listOf(contactEmail1, contactEmail2)
val list2 = listOf(contactEmail3)
val contactLabel1 =

View File

@ -230,7 +230,8 @@ class ContactGroupEditCreateRepositoryTest {
contactEmailId = testMember1,
email = "firstsender@protonmail.com",
name = "firstContactName",
labelIds = listOf(testLabel1Id, testLabel2Id, testLabel3Id)
labelIds = listOf(testLabel1Id, testLabel2Id, testLabel3Id),
lastUsedTime = "111"
)
val inputContactEmails = listOf(inputContactEmail)
coEvery { contactsRepository.findAllContactEmailsByContactGroupId(testGroupId) } returns inputContactEmails
@ -265,7 +266,8 @@ class ContactGroupEditCreateRepositoryTest {
contactEmailId = testMember1,
email = "firstsender@protonmail.com",
name = "firstContactName",
labelIds = listOf(testLabel1Id, testLabel2Id)
labelIds = listOf(testLabel1Id, testLabel2Id),
lastUsedTime = "111"
)
coEvery { contactsRepository.findAllContactEmailsById(testMember1) } returns existingContactEmail

View File

@ -104,9 +104,11 @@ class ContactsListMapperTest {
val dataList = listOf(contact1, contact2)
val contactEmail1 = ContactEmail(
contactEmailId = "contactEmailId1", email = email1, name = "emailName1", contactId = contactId1,
lastUsedTime = "111"
)
val contactEmail2 = ContactEmail(
contactEmailId = "contactEmailId2", email = email2, name = "emailName1", contactId = contactId2
contactEmailId = "contactEmailId2", email = email2, name = "emailName1", contactId = contactId2,
lastUsedTime = "112"
)
val emailsList = listOf(contactEmail1, contactEmail2)
val expected = listOf(

View File

@ -84,8 +84,8 @@ class CreateContactTest : CoroutinesTest {
private val encryptedData = "encryptedContactData"
private val signedData = "signedContactData"
private val contactEmails = listOf(
ContactEmail("ID1", "email@proton.com", "Tom"),
ContactEmail("ID2", "secondary@proton.com", "Mike")
ContactEmail("ID1", "email@proton.com", "Tom", lastUsedTime = "111"),
ContactEmail("ID2", "secondary@proton.com", "Mike", lastUsedTime = "112")
)
private val cacheDirPath = "CacheDirPath"
@ -107,9 +107,10 @@ class CreateContactTest : CoroutinesTest {
createContact("Mike", contactEmails, encryptedData, signedData)
val emailWithContactId = ContactEmail("ID1", "email@proton.com", "Tom", contactId = "contactDataId")
val emailWithContactId =
ContactEmail("ID1", "email@proton.com", "Tom", contactId = "contactDataId", lastUsedTime = "111")
val secondaryEmailWithContactId =
ContactEmail("ID2", "secondary@proton.com", "Mike", contactId = "contactDataId")
ContactEmail("ID2", "secondary@proton.com", "Mike", contactId = "contactDataId", lastUsedTime = "112")
val expectedContactEmails = listOf(emailWithContactId, secondaryEmailWithContactId)
coVerify { contactsRepository.saveContactEmails(expectedContactEmails) }
}
@ -198,14 +199,16 @@ class CreateContactTest : CoroutinesTest {
order = 1,
defaults = 1,
type = mutableListOf("email"),
labelIds = emptyList()
labelIds = emptyList(),
lastUsedTime = "111"
),
ContactEmail(
"HsdksdkjnZ8A-I6w==",
"secondary@proton.com",
"Mike",
contactId = "jB_6lbgFc7QA12w==",
labelIds = emptyList()
labelIds = emptyList(),
lastUsedTime = "112"
)
)
val serverEmailsJson = """
@ -225,7 +228,8 @@ class CreateContactTest : CoroutinesTest {
"selected": false,
"type": [
"email"
]
],
"lastUsedTime": "111"
},
{
"contactEmailId": "HsdksdkjnZ8A-I6w==",
@ -240,7 +244,8 @@ class CreateContactTest : CoroutinesTest {
"pgpIcon": 0,
"pgpIconColor": 0,
"selected": false,
"type": null
"type": null,
"lastUsedTime": "112"
}
]

View File

@ -150,10 +150,11 @@ class CreateContactWorkerTest {
fun workerReturnsServerContactIdAndAllResponsesContactEmailsSerialisedWhenApiCallSucceedsRetuningNonEmptyContactId() {
runBlockingTest {
val contactId = "serverContactId"
val serverContactEmails = listOf(ContactEmail("emailId", "first@pm.me", "firstcontact"))
val serverContactEmails =
listOf(ContactEmail("emailId", "first@pm.me", "firstcontact", lastUsedTime = "111"))
val serverContactEmails1 = listOf(
ContactEmail("emailId1", "second@pm.me", "secondcontact"),
ContactEmail("emailId2", "third@pm.me", "thirdcontact")
ContactEmail("emailId1", "second@pm.me", "secondcontact", lastUsedTime = "113"),
ContactEmail("emailId2", "third@pm.me", "thirdcontact", lastUsedTime = "112")
)
val responses = mockk<ContactResponse.Responses> {
every { response.contact.emails } returns serverContactEmails

View File

@ -2,16 +2,19 @@
{
"contactEmailId": "emailId",
"email": "first@pm.me",
"name": "firstcontact"
"name": "firstcontact",
"lastUsedTime": "111"
},
{
"contactEmailId": "emailId1",
"email": "second@pm.me",
"name": "secondcontact"
"name": "secondcontact",
"lastUsedTime": "113"
},
{
"contactEmailId": "emailId2",
"email": "third@pm.me",
"name": "thirdcontact"
"name": "thirdcontact",
"lastUsedTime": "112"
}
]