Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add more message status icons #2045

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions app/src/main/kotlin/com/wire/android/mapper/MessageMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,16 @@ class MessageMapper @Inject constructor(
val flowStatus = if (content is MessageContent.FailedDecryption) {
MessageFlowStatus.Failure.Decryption(content.isDecryptionResolved)
} else {
when (message.status) {
Message.Status.PENDING -> MessageFlowStatus.Sending
Message.Status.SENT -> MessageFlowStatus.Sent
Message.Status.READ -> MessageFlowStatus.Read(1) // TODO add read count
Message.Status.FAILED -> MessageFlowStatus.Failure.Send.Locally(isMessageEdited)
Message.Status.FAILED_REMOTELY -> MessageFlowStatus.Failure.Send.Remotely(isMessageEdited, message.conversationId.domain)
when (val status = message.status) {
Message.Status.Pending -> MessageFlowStatus.Sending
Message.Status.Sent -> MessageFlowStatus.Sent
is Message.Status.Read -> MessageFlowStatus.Read(status.readCount)
Message.Status.Failed -> MessageFlowStatus.Failure.Send.Locally(isMessageEdited)
Message.Status.FailedRemotely -> MessageFlowStatus.Failure.Send.Remotely(
isEdited = isMessageEdited,
backendWithFailure = message.conversationId.domain
)
Message.Status.Delivered -> MessageFlowStatus.Delivered
trOnk12 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
*/
package com.wire.android.ui.home.conversations

import androidx.compose.foundation.layout.Row
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
Expand Down Expand Up @@ -46,16 +48,37 @@ fun MessageStatusIndicator(status: MessageFlowStatus, modifier: Modifier = Modif
tint = MaterialTheme.wireColorScheme.error,
contentDescription = stringResource(R.string.content_description_message_error_status),
)
// TODO handle read, sent and delivered status
// MessageFlowStatus.Sent -> Icon(
// modifier = modifier,
// painter = painterResource(id = R.drawable.ic_message_delivered),
// tint = MaterialTheme.wireColorScheme.onTertiaryButtonDisabled,
// contentDescription = stringResource(R.string.content_description_message_delivered_status),
// )
// is MessageFlowStatus.Read -> {}
// MessageFlowStatus.Delivered -> TODO()
else -> HorizontalSpace.x16()

MessageFlowStatus.Sent -> {
Icon(
modifier = modifier,
painter = painterResource(id = R.drawable.ic_message_sent),
tint = MaterialTheme.wireColorScheme.onTertiaryButtonDisabled,
contentDescription = stringResource(R.string.content_description_message_sent_status),
)
}

MessageFlowStatus.Delivered -> {
Icon(
modifier = modifier,
painter = painterResource(id = R.drawable.ic_message_delivered),
tint = MaterialTheme.wireColorScheme.onTertiaryButtonDisabled,
contentDescription = stringResource(R.string.content_description_message_delivered_status),
)
}

is MessageFlowStatus.Read -> {
Row {
Icon(
modifier = modifier,
painter = painterResource(id = R.drawable.ic_message_read),
tint = MaterialTheme.wireColorScheme.onTertiaryButtonDisabled,
contentDescription = stringResource(R.string.content_description_message_read_status),
)
HorizontalSpace.x4()
Text(status.count.toString())
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ sealed class MessageEditStatus {

sealed class MessageFlowStatus {

object Sending : MessageFlowStatus()
object Sent : MessageFlowStatus()
data object Sending : MessageFlowStatus()
data object Sent : MessageFlowStatus()
sealed class Failure(val errorText: UIText) : MessageFlowStatus() {
sealed class Send(errorText: UIText) : Failure(errorText) {
data class Locally(val isEdited: Boolean) : Send(
Expand Down Expand Up @@ -157,9 +157,9 @@ sealed class MessageFlowStatus {
)
}

object Delivered : MessageFlowStatus()
data object Delivered : MessageFlowStatus()

data class Read(val count: Int) : MessageFlowStatus()
data class Read(val count: Long) : MessageFlowStatus()
}

@Stable
Expand Down
2 changes: 1 addition & 1 deletion kalium
Submodule kalium updated 132 files