Update Rust to 0.158.0

NOJIRA
This commit is contained in:
Niccolò Forlini
2025-11-21 13:29:53 +01:00
committed by MargeBot
parent cac3f26d44
commit eea14b5852
22 changed files with 133 additions and 88 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ material = "1.13.0"
mockk = "1.14.6"
paparazzi = "1.3.5"
proton-core = "34.1.0"
proton-rust-core = "0.157.12"
proton-rust-core = "0.158.0"
robolectric = "4.15.1" # 4.16.0 requires Java 21
kotlinpoet-ksp = "2.2.0"
leakcanary = "2.14"
@@ -66,7 +66,7 @@ fun LocalConversation.toConversation() = Conversation(
size = size.toLong(),
customLabels = this.customLabels.map { it.toLabel() },
avatarInformation = this.avatar.toAvatarInformation(),
exclusiveLocation = this.exclusiveLocation.toExclusiveLocation(),
exclusiveLocation = this.locations.map { it.toExclusiveLocation() },
snoozeInformation = this.toSnoozeInformation(),
hiddenMessagesBanner = this.hiddenMessagesBanner?.toHiddenMessagesBanner()
)
@@ -76,7 +76,7 @@ class ConversationMapperTest {
assertFalse(conversation.isStarred)
assertEquals(localConversation.time.toLong(), conversation.time)
assertEquals(localConversation.size.toLong(), conversation.size)
assertEquals(localConversation.exclusiveLocation.toExclusiveLocation(), conversation.exclusiveLocation)
assertEquals(localConversation.locations.map { it.toExclusiveLocation() }, conversation.exclusiveLocation)
assertEquals(NoSnooze, conversation.snoozeInformation)
}
@@ -251,7 +251,7 @@ class ConversationMapperTest {
isStarred = isStarred,
attachmentsMetadata = attachmentsMetadata,
displaySnoozeReminder = displaySnoozeReminder,
exclusiveLocation = exclusiveLocation,
locations = listOf(exclusiveLocation),
avatar = avatar,
totalMessages = totalMessages,
totalUnread = totalUnread,
@@ -45,7 +45,7 @@ data class Conversation(
val size: Long,
val customLabels: List<Label>,
val avatarInformation: AvatarInformation,
val exclusiveLocation: ExclusiveLocation,
val exclusiveLocation: List<ExclusiveLocation>,
val snoozeInformation: ConversationSnoozeStatus,
val hiddenMessagesBanner: HiddenMessagesBanner?
)
@@ -87,7 +87,7 @@ object ConversationSample {
subject: String = "subject",
userId: UserId = UserIdSample.Primary,
numMessages: Int = 0,
exclusiveLocation: ExclusiveLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
exclusiveLocation: List<ExclusiveLocation> = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
) = Conversation(
conversationId = conversationId,
order = 0,
@@ -48,7 +48,7 @@ class ConversationMailboxItemMapper @Inject constructor() : Mapper<Conversation,
expirationTime = expirationTime,
calendarAttachmentCount = attachmentCount.calendar,
avatarInformation = avatarInformation,
exclusiveLocation = exclusiveLocation,
exclusiveLocations = exclusiveLocation,
attachments = attachments,
isDraft = false,
isScheduled = false,
@@ -47,7 +47,7 @@ class MessageMailboxItemMapper @Inject constructor() : Mapper<Message, MailboxIt
expirationTime = message.expirationTime,
calendarAttachmentCount = message.attachmentCount.calendar,
avatarInformation = message.avatarInformation,
exclusiveLocation = message.exclusiveLocation,
exclusiveLocations = listOf(message.exclusiveLocation),
attachments = message.attachments,
isDraft = message.isDraft,
isScheduled = message.isScheduled,
@@ -59,7 +59,7 @@ data class MailboxItem(
val expirationTime: Long,
val calendarAttachmentCount: Int,
val avatarInformation: AvatarInformation,
val exclusiveLocation: ExclusiveLocation,
val exclusiveLocations: List<ExclusiveLocation>,
val attachments: List<AttachmentMetadata>,
val isDraft: Boolean,
val isScheduled: Boolean,
@@ -36,11 +36,11 @@ class ShouldShowLocationIndicator @Inject constructor(
suspend operator fun invoke(
userId: UserId,
mailLabelId: MailLabelId,
itemLocation: ExclusiveLocation
exclusiveLocations: List<ExclusiveLocation>
): Boolean {
return when (mailLabelId) {
is MailLabelId.Custom.Label -> true
is MailLabelId.System -> shouldShowIconForSystemLabel(userId, mailLabelId, itemLocation)
is MailLabelId.System -> shouldShowIconForSystemLabel(userId, mailLabelId, exclusiveLocations)
else -> false
}
}
@@ -48,12 +48,12 @@ class ShouldShowLocationIndicator @Inject constructor(
private suspend fun shouldShowIconForSystemLabel(
userId: UserId,
currentMailLabel: MailLabelId,
itemLocation: ExclusiveLocation
exclusiveLocations: List<ExclusiveLocation>
): Boolean {
val systemLabels = systemLabelsCache.getOrPut(userId) {
labelRepository.observeSystemLabels(userId).firstOrNull()
}
val isItemScheduledForSend = isItemScheduledForSend(itemLocation)
val isItemScheduledForSend = isItemScheduledForSend(exclusiveLocations)
val isCurrentLocationSent = isCurrentLocationSent(systemLabels, currentMailLabel)
val itemIsScheduledAndLocationIsSent = isItemScheduledForSend && isCurrentLocationSent
@@ -83,10 +83,12 @@ class ShouldShowLocationIndicator @Inject constructor(
.map { it.label.labelId }
.contains(currentMailLabel.labelId)
private fun isItemScheduledForSend(itemLocation: ExclusiveLocation) = when (itemLocation) {
is ExclusiveLocation.System -> itemLocation.systemLabelId == SystemLabelId.AllScheduled
is ExclusiveLocation.Folder,
ExclusiveLocation.NoLocation -> false
}
private fun isItemScheduledForSend(exclusiveLocations: List<ExclusiveLocation>) =
exclusiveLocations.any { location ->
when (location) {
is ExclusiveLocation.System -> location.systemLabelId == SystemLabelId.AllScheduled
is ExclusiveLocation.Folder,
ExclusiveLocation.NoLocation -> false
}
}
}
@@ -36,7 +36,7 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class ShouldShowLocationIndicatorTest {
internal class ShouldShowLocationIndicatorTest {
private val userId = UserIdSample.Primary
@@ -71,10 +71,10 @@ class ShouldShowLocationIndicatorTest {
fun `should return true when current location is a custom label`() = runTest {
// Given
val currentLocation = MailLabelId.Custom.Label(LabelId("0"))
val itemLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertTrue(result)
@@ -84,11 +84,11 @@ class ShouldShowLocationIndicatorTest {
fun `should return false when current system location is not in exclusive system labels`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.Inbox.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(emptyList())
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertFalse(result)
@@ -99,11 +99,11 @@ class ShouldShowLocationIndicatorTest {
fun `should return true when current system location is starred`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.Starred.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertTrue(result)
@@ -114,11 +114,11 @@ class ShouldShowLocationIndicatorTest {
fun `should return true when current system location is AllMail`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.AllMail.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertTrue(result)
@@ -128,11 +128,11 @@ class ShouldShowLocationIndicatorTest {
fun `should return true when current system location is AlmostAllMail`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.AlmostAllMail.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertTrue(result)
@@ -143,12 +143,12 @@ class ShouldShowLocationIndicatorTest {
// Given
val firstLocation = MailLabelId.System(SystemLabelId.Archive.labelId)
val secondLocation = MailLabelId.System(SystemLabelId.Starred.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val firstResult = shouldShowLocationIndicator.invoke(userId, firstLocation, itemLocation)
val secondResult = shouldShowLocationIndicator.invoke(userId, secondLocation, itemLocation)
val firstResult = shouldShowLocationIndicator.invoke(userId, firstLocation, itemLocations)
val secondResult = shouldShowLocationIndicator.invoke(userId, secondLocation, itemLocations)
// Then
verify(exactly = 1) { labelRepository.observeSystemLabels(any()) }
@@ -160,11 +160,11 @@ class ShouldShowLocationIndicatorTest {
fun `should return true when system location is Sent and mailboxItem is scheduled for sending`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.Sent.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.AllScheduled, LabelId("12"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.AllScheduled, LabelId("12")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertTrue(result)
@@ -174,11 +174,11 @@ class ShouldShowLocationIndicatorTest {
fun `should return true when system location is All Sent and mailboxItem is scheduled for sending`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.AllSent.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.AllScheduled, LabelId("12"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.AllScheduled, LabelId("12")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertTrue(result)
@@ -188,14 +188,13 @@ class ShouldShowLocationIndicatorTest {
fun `should return false when current system location is Sent and mailboxItem is not scheduled`() = runTest {
// Given
val currentLocation = MailLabelId.System(SystemLabelId.Sent.labelId)
val itemLocation = ExclusiveLocation.System(SystemLabelId.Sent, LabelId("7"))
val itemLocations = listOf(ExclusiveLocation.System(SystemLabelId.Sent, LabelId("7")))
coEvery { labelRepository.observeSystemLabels(any()) } returns flowOf(systemLabels)
// When
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocation)
val result = shouldShowLocationIndicator.invoke(userId, currentLocation, itemLocations)
// Then
assertFalse(result)
}
}
@@ -116,7 +116,7 @@ class MailboxItemUiModelMapper @Inject constructor(
)
) {
is GetMailboxItemLocationIcon.Result.None -> emptyList()
is GetMailboxItemLocationIcon.Result.Icon -> listOfNotNull(iconResult.icon)
is GetMailboxItemLocationIcon.Result.Icon -> iconResult.icons
}.toImmutableList()
private fun areAllAttachmentsExcludedFromPreview(mailboxItem: MailboxItem) =
@@ -48,38 +48,40 @@ class GetMailboxItemLocationIcon @Inject constructor(
return Result.None
}
val icon = getLocationIcon(mailboxItem, folderColorSettings) ?: return Result.None
val icon = getLocationIcons(mailboxItem, folderColorSettings).takeIf { it.isNotEmpty() } ?: return Result.None
return Result.Icon(icon)
}
private fun getLocationIcon(
private fun getLocationIcons(
mailboxItem: MailboxItem,
folderColorSettings: FolderColorSettings
): MailboxItemLocationUiModel? {
return when (val location = mailboxItem.exclusiveLocation) {
is ExclusiveLocation.System -> {
val iconDrawable = location.systemLabelId.iconRes()
MailboxItemLocationUiModel(iconDrawable)
}
is ExclusiveLocation.Folder -> {
when (folderColorSettings.useFolderColor) {
true -> MailboxItemLocationUiModel(
icon = R.drawable.ic_proton_folder_filled,
color = colorMapper.toColor(location.color).getOrElse { Color.Transparent }
)
false -> MailboxItemLocationUiModel(R.drawable.ic_proton_folder)
): List<MailboxItemLocationUiModel> {
return mailboxItem.exclusiveLocations.take(ICON_COUNT_THRESHOLD).mapNotNull { location ->
when (location) {
is ExclusiveLocation.System -> {
val iconDrawable = location.systemLabelId.iconRes()
MailboxItemLocationUiModel(iconDrawable)
}
}
else -> null
is ExclusiveLocation.Folder -> {
when (folderColorSettings.useFolderColor) {
true -> MailboxItemLocationUiModel(
icon = R.drawable.ic_proton_folder_filled,
color = colorMapper.toColor(location.color).getOrElse { Color.Transparent }
)
false -> MailboxItemLocationUiModel(R.drawable.ic_proton_folder)
}
}
ExclusiveLocation.NoLocation -> null
}
}
}
private suspend fun shouldShowIcons(userId: UserId, mailboxItem: MailboxItem): Boolean {
val currentLocation = getSelectedMailLabelId()
val itemLocation = mailboxItem.exclusiveLocation
val itemLocation = mailboxItem.exclusiveLocations
// Should show when starred, all mail, almost all mail or custom label
return shouldShowLocationIndicator(userId, currentLocation, itemLocation)
@@ -88,7 +90,12 @@ class GetMailboxItemLocationIcon @Inject constructor(
sealed interface Result {
data object None : Result
data class Icon(
val icon: MailboxItemLocationUiModel
val icons: List<MailboxItemLocationUiModel>
) : Result
}
private companion object {
const val ICON_COUNT_THRESHOLD = 3
}
}
@@ -316,7 +316,7 @@ class MailboxItemUiModelMapperTest {
val labelIds = listOf(SystemLabelId.Inbox.labelId, SystemLabelId.Drafts.labelId)
val mailboxItem = buildMailboxItem(labelIds = labelIds, type = MailboxItemType.Conversation)
val inboxIconRes = MailboxItemLocationUiModel(R.drawable.ic_proton_inbox)
val icons = GetMailboxItemLocationIcon.Result.Icon(inboxIconRes)
val icons = GetMailboxItemLocationIcon.Result.Icon(listOf(inboxIconRes))
coEvery {
getMailboxItemLocationIcons.invoke(
userId,
@@ -27,6 +27,7 @@ import ch.protonmail.android.maillabel.domain.model.LabelId
import ch.protonmail.android.maillabel.domain.model.MailLabelId
import ch.protonmail.android.maillabel.domain.model.SystemLabelId
import ch.protonmail.android.maillabel.domain.usecase.GetSelectedMailLabelId
import ch.protonmail.android.maillabel.presentation.R
import ch.protonmail.android.mailmailbox.domain.usecase.ShouldShowLocationIndicator
import ch.protonmail.android.mailsettings.domain.model.FolderColorSettings
import ch.protonmail.android.testdata.mailbox.MailboxTestData.buildMailboxItem
@@ -35,9 +36,9 @@ import io.mockk.every
import io.mockk.mockk
import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertTrue
import org.junit.Test
import kotlinx.coroutines.test.runTest
import ch.protonmail.android.maillabel.presentation.R
import org.junit.Test
import kotlin.test.assertIs
class GetMailboxItemLocationIconTest {
@@ -75,10 +76,7 @@ class GetMailboxItemLocationIconTest {
fun `should return Icon with system label icon`() = runTest {
// Given
val mailboxItem = buildMailboxItem(
exclusiveLocation = ExclusiveLocation.System(
SystemLabelId.Inbox,
LabelId("1")
)
exclusiveLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
)
val folderColorSettings = FolderColorSettings(useFolderColor = false, inheritParentFolderColor = false)
@@ -96,7 +94,7 @@ class GetMailboxItemLocationIconTest {
fun `should return Icon with custom label and folder color`() = runTest {
// Given
val mailboxItem = buildMailboxItem(
exclusiveLocation = ExclusiveLocation.Folder("Custom folder", LabelId("1"), "#FF5733")
exclusiveLocations = listOf(ExclusiveLocation.Folder("Custom folder", LabelId("1"), "#FF5733"))
)
val folderColorSettings = FolderColorSettings(useFolderColor = true, inheritParentFolderColor = false)
@@ -109,15 +107,16 @@ class GetMailboxItemLocationIconTest {
// Then
assertTrue(result is GetMailboxItemLocationIcon.Result.Icon)
assertEquals(R.drawable.ic_proton_folder_filled, (result as GetMailboxItemLocationIcon.Result.Icon).icon.icon)
assertEquals(Color(0xFFFF5733), result.icon.color)
assertIs<GetMailboxItemLocationIcon.Result.Icon>(result)
assertEquals(R.drawable.ic_proton_folder_filled, result.icons.first().icon)
assertEquals(Color(0xFFFF5733), result.icons.first().color)
}
@Test
fun `should return Icon with custom label without folder color`() = runTest {
// Given
val mailboxItem = buildMailboxItem(
exclusiveLocation = ExclusiveLocation.Folder("Custom folder", LabelId("1"), "#FF5733")
exclusiveLocations = listOf(ExclusiveLocation.Folder("Custom folder", LabelId("1"), "#FF5733"))
)
val folderColorSettings = FolderColorSettings(useFolderColor = false, inheritParentFolderColor = false)
coEvery { shouldShowLocationIndicator(userId, any(), any()) } returns true
@@ -128,6 +127,37 @@ class GetMailboxItemLocationIconTest {
// Then
assertTrue(result is GetMailboxItemLocationIcon.Result.Icon)
assertEquals(R.drawable.ic_proton_folder, (result as GetMailboxItemLocationIcon.Result.Icon).icon.icon)
assertIs<GetMailboxItemLocationIcon.Result.Icon>(result)
assertEquals(R.drawable.ic_proton_folder, result.icons.first().icon)
}
@Test
fun `should return maximum of 3 icons when item has multiple locations`() = runTest {
// Given
val mailboxItem = buildMailboxItem(
exclusiveLocations = listOf(
ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("0")),
ExclusiveLocation.System(SystemLabelId.Starred, LabelId("4")),
ExclusiveLocation.Folder("Custom folder", LabelId("1"), "#FF5733"),
ExclusiveLocation.System(SystemLabelId.Archive, LabelId("7"))
)
)
val folderColorSettings = FolderColorSettings(useFolderColor = true, inheritParentFolderColor = false)
every { colorMapper.toColor("#FF5733") } returns Color(0xFFFF5733).right()
coEvery { shouldShowLocationIndicator(userId, any(), any()) } returns true
coEvery { getSelectedMailLabelId() } returns MailLabelId.System(SystemLabelId.AllMail.labelId)
// When
val result = getMailboxItemLocationIcon(userId, mailboxItem, folderColorSettings, isShowingSearchResults = true)
// Then
assertTrue(result is GetMailboxItemLocationIcon.Result.Icon)
assertIs<GetMailboxItemLocationIcon.Result.Icon>(result)
assertEquals(3, result.icons.size)
assertEquals(R.drawable.ic_proton_inbox, result.icons[0].icon)
assertEquals(R.drawable.ic_proton_star, result.icons[1].icon)
assertEquals(R.drawable.ic_proton_folder_filled, result.icons[2].icon)
assertEquals(Color(0xFFFF5733), result.icons[2].color)
}
}
@@ -114,7 +114,7 @@ fun LocalMessageMetadata.toMessage(): Message {
.map { it.toAttachmentMetadata() },
customLabels = customLabels.map { it.toLabel() },
avatarInformation = this.avatar.toAvatarInformation(),
exclusiveLocation = this.exclusiveLocation.toExclusiveLocation(),
exclusiveLocation = this.location.toExclusiveLocation(),
isDraft = this.isDraft,
isScheduled = this.isScheduled,
isReplyAllowed = this.canReply,
@@ -77,7 +77,7 @@ class MessageMapperTest {
avatar = LocalAvatarInformation("SN", "#FFFFFF"),
attachmentsMetadata = emptyList(),
customLabels = emptyList(),
exclusiveLocation = exclusiveLocation,
location = exclusiveLocation,
snoozedUntil = 12345u,
isDraft = false,
isScheduled = false,
@@ -215,7 +215,7 @@ class MessageMapperTest {
flags = flags,
starred = starred,
attachmentsMetadata = attachments,
exclusiveLocation = exclusiveLocation,
location = exclusiveLocation,
avatar = avatarInformation,
isDraft = false,
isScheduled = false,
@@ -301,7 +301,7 @@ class MessageMapperTest {
flags = MessageFlags(1897uL),
starred = false,
attachmentsMetadata = listOf(attachment1, attachment2),
exclusiveLocation = null,
location = null,
avatar = LocalAvatarInformation("S", "blue"),
isDraft = false,
isScheduled = false,
@@ -123,7 +123,7 @@ object ConversationTestData {
attachmentCount: AttachmentCount = AttachmentCount(0),
numUnRead: Int = 0,
isStarred: Boolean = false,
exclusiveLocation: ExclusiveLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
exclusiveLocation: List<ExclusiveLocation> = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
) = Conversation(
conversationId = ConversationId(id),
order = 0,
@@ -155,7 +155,7 @@ object ConversationTestData {
numAttachments: Int = 0,
expirationTime: Long = 0,
attachmentCount: AttachmentCount = AttachmentCount(0),
exclusiveLocation: ExclusiveLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
exclusiveLocation: List<ExclusiveLocation> = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
) = Conversation(
conversationId = ConversationId(id),
order = 0,
@@ -99,7 +99,7 @@ object ConversationWithContextTestData {
numAttachments: Int = 2,
expirationTime: Long = 0,
attachmentCount: AttachmentCount = AttachmentCount(0),
exclusiveLocation: ExclusiveLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
exclusiveLocation: List<ExclusiveLocation> = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")))
) = Conversation(
conversationId = ConversationId(id),
order = order,
@@ -199,7 +199,7 @@ object LocalConversationTestData {
customLabels = labels,
isStarred = starred,
displaySnoozeReminder = false,
exclusiveLocation = null,
locations = emptyList(),
avatar = avatarInformation,
attachmentsMetadata = attachments,
totalMessages = numMessages,
@@ -69,7 +69,12 @@ object MailboxTestData {
hasAttachments: Boolean = false,
expirationTime: Long = 0,
calendarAttachmentCount: Int = 0,
exclusiveLocation: ExclusiveLocation = ExclusiveLocation.System(SystemLabelId.Sent, LabelId("1")),
exclusiveLocations: List<ExclusiveLocation> = listOf(
ExclusiveLocation.System(
SystemLabelId.Sent,
LabelId("1")
)
),
attachments: List<AttachmentMetadata> = emptyList(),
isScheduled: Boolean = false
) = MailboxItem(
@@ -93,7 +98,7 @@ object MailboxTestData {
expirationTime = expirationTime,
calendarAttachmentCount = calendarAttachmentCount,
avatarInformation = AvatarInformationSample.avatarSample,
exclusiveLocation = exclusiveLocation,
exclusiveLocations = exclusiveLocations,
attachments = attachments,
isDraft = false,
isScheduled = isScheduled,
@@ -107,7 +112,9 @@ object MailboxTestData {
isRepliedAll: Boolean = false,
isForwarded: Boolean = false,
labels: List<Label> = emptyList(),
exclusiveLocation: ExclusiveLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")),
exclusiveLocation: List<ExclusiveLocation> = listOf(
ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))
),
attachments: List<AttachmentMetadata> = emptyList()
) = MailboxItem(
type = MailboxItemType.Message,
@@ -130,7 +137,7 @@ object MailboxTestData {
expirationTime = 0,
calendarAttachmentCount = 0,
avatarInformation = AvatarInformationSample.avatarSample,
exclusiveLocation = exclusiveLocation,
exclusiveLocations = exclusiveLocation,
attachments = attachments,
isDraft = false,
isScheduled = false,
@@ -158,7 +165,7 @@ object MailboxTestData {
expirationTime = 0,
calendarAttachmentCount = 0,
avatarInformation = AvatarInformationSample.avatarSample,
exclusiveLocation = ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1")),
exclusiveLocations = listOf(ExclusiveLocation.System(SystemLabelId.Inbox, LabelId("1"))),
attachments = emptyList(),
isDraft = false,
isScheduled = false,
@@ -243,7 +243,7 @@ object LocalMessageTestData {
bccList = bcc,
attachmentsMetadata = attachments,
customLabels = labels,
exclusiveLocation = null,
location = null,
avatar = avatarInformation,
isDraft = false,
isScheduled = false,