Merge pull request #3343 from element-hq/renovate/org.matrix.rustcomponents-sdk-android-0.x
Update dependency org.matrix.rustcomponents:sdk-android to v0.2.40
This commit is contained in:
commit
45c216c7a3
22 changed files with 87 additions and 52 deletions
|
|
@ -84,7 +84,7 @@ internal fun aTimelineItemList(content: TimelineItemEventContent): ImmutableList
|
|||
isMine = false,
|
||||
content = content,
|
||||
groupPosition = TimelineItemGroupPosition.Middle,
|
||||
sendState = LocalEventSendState.SendingFailed.Unrecoverable("Message failed to send"),
|
||||
sendState = LocalEventSendState.Failed.Unknown("Message failed to send"),
|
||||
),
|
||||
aTimelineItemEvent(
|
||||
isMine = false,
|
||||
|
|
@ -107,7 +107,7 @@ internal fun aTimelineItemList(content: TimelineItemEventContent): ImmutableList
|
|||
isMine = true,
|
||||
content = content,
|
||||
groupPosition = TimelineItemGroupPosition.Middle,
|
||||
sendState = LocalEventSendState.SendingFailed.Unrecoverable("Message failed to send"),
|
||||
sendState = LocalEventSendState.Failed.Unknown("Message failed to send"),
|
||||
),
|
||||
aTimelineItemEvent(
|
||||
isMine = true,
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ internal fun MessageShield.toText(): String {
|
|||
is MessageShield.UnsignedDevice -> CommonStrings.event_shield_reason_unsigned_device
|
||||
is MessageShield.UnverifiedIdentity -> CommonStrings.event_shield_reason_unverified_identity
|
||||
is MessageShield.SentInClear -> CommonStrings.event_shield_reason_sent_in_clear
|
||||
is MessageShield.PreviouslyVerified -> CommonStrings.event_shield_reason_previously_verified
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -98,7 +99,8 @@ internal fun MessageShield.toIcon(): ImageVector {
|
|||
is MessageShield.AuthenticityNotGuaranteed -> CompoundIcons.Info()
|
||||
is MessageShield.UnknownDevice,
|
||||
is MessageShield.UnsignedDevice,
|
||||
is MessageShield.UnverifiedIdentity -> CompoundIcons.HelpSolid()
|
||||
is MessageShield.UnverifiedIdentity,
|
||||
is MessageShield.PreviouslyVerified -> CompoundIcons.HelpSolid()
|
||||
is MessageShield.SentInClear -> CompoundIcons.LockOff()
|
||||
}
|
||||
}
|
||||
|
|
@ -126,6 +128,9 @@ internal fun MessageShieldViewPreview() {
|
|||
MessageShieldView(
|
||||
shield = MessageShield.SentInClear(false)
|
||||
)
|
||||
MessageShieldView(
|
||||
shield = MessageShield.PreviouslyVerified(false)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,10 +51,10 @@ fun TimelineEventTimestampView(
|
|||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val formattedTime = event.sentTime
|
||||
val hasUnrecoverableError = event.localSendState is LocalEventSendState.SendingFailed.Unrecoverable
|
||||
val hasError = event.localSendState is LocalEventSendState.Failed
|
||||
val hasEncryptionCritical = event.messageShield?.isCritical.orFalse()
|
||||
val isMessageEdited = event.content.isEdited()
|
||||
val tint = if (hasUnrecoverableError || hasEncryptionCritical) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.secondary
|
||||
val tint = if (hasError || hasEncryptionCritical) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.secondary
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(PaddingValues(start = TimelineEventTimestampViewDefaults.spacing))
|
||||
|
|
@ -74,7 +74,7 @@ fun TimelineEventTimestampView(
|
|||
style = ElementTheme.typography.fontBodyXsRegular,
|
||||
color = tint,
|
||||
)
|
||||
if (hasUnrecoverableError) {
|
||||
if (hasError) {
|
||||
Spacer(modifier = Modifier.width(2.dp))
|
||||
Icon(
|
||||
imageVector = CompoundIcons.Error(),
|
||||
|
|
|
|||
|
|
@ -27,15 +27,13 @@ class TimelineItemEventForTimestampViewProvider : PreviewParameterProvider<Timel
|
|||
override val values: Sequence<TimelineItem.Event>
|
||||
get() = sequenceOf(
|
||||
aTimelineItemEvent(),
|
||||
// Sending failed recoverable
|
||||
aTimelineItemEvent().copy(localSendState = LocalEventSendState.SendingFailed.Recoverable("AN_ERROR")),
|
||||
// Sending failed unrecoverable
|
||||
aTimelineItemEvent().copy(localSendState = LocalEventSendState.SendingFailed.Unrecoverable("AN_ERROR")),
|
||||
aTimelineItemEvent().copy(localSendState = LocalEventSendState.Sending),
|
||||
aTimelineItemEvent().copy(localSendState = LocalEventSendState.Failed.Unknown("AN_ERROR")),
|
||||
// Edited
|
||||
aTimelineItemEvent().copy(content = aTimelineItemTextContent().copy(isEdited = true)),
|
||||
// Sending failed + Edited (not sure this is possible IRL, but should be covered by test)
|
||||
aTimelineItemEvent().copy(
|
||||
localSendState = LocalEventSendState.SendingFailed.Unrecoverable("AN_ERROR"),
|
||||
localSendState = LocalEventSendState.Failed.Unknown("AN_ERROR"),
|
||||
content = aTimelineItemTextContent().copy(isEdited = true),
|
||||
),
|
||||
aTimelineItemEvent().copy(
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class ReadReceiptViewStateForTimelineItemEventRowProvider :
|
|||
override val values: Sequence<ReadReceiptViewState>
|
||||
get() = sequenceOf(
|
||||
aReadReceiptViewState(
|
||||
sendState = LocalEventSendState.NotSentYet
|
||||
sendState = LocalEventSendState.Sending,
|
||||
),
|
||||
aReadReceiptViewState(
|
||||
sendState = LocalEventSendState.Sent(EventId("\$eventId")),
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class ReadReceiptViewStateProvider : PreviewParameterProvider<ReadReceiptViewSta
|
|||
override val values: Sequence<ReadReceiptViewState>
|
||||
get() = sequenceOf(
|
||||
aReadReceiptViewState(),
|
||||
aReadReceiptViewState(sendState = LocalEventSendState.NotSentYet),
|
||||
aReadReceiptViewState(sendState = LocalEventSendState.Sending),
|
||||
aReadReceiptViewState(sendState = LocalEventSendState.Sent(EventId("\$eventId"))),
|
||||
aReadReceiptViewState(
|
||||
sendState = LocalEventSendState.Sent(EventId("\$eventId")),
|
||||
|
|
|
|||
|
|
@ -70,19 +70,18 @@ fun TimelineItemReadReceiptView(
|
|||
ReadReceiptsAvatars(
|
||||
receipts = state.receipts,
|
||||
modifier = Modifier
|
||||
.testTag(TestTags.messageReadReceipts)
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.clickable {
|
||||
onReadReceiptsClick()
|
||||
}
|
||||
.padding(2.dp)
|
||||
.testTag(TestTags.messageReadReceipts)
|
||||
.clip(RoundedCornerShape(4.dp))
|
||||
.clickable {
|
||||
onReadReceiptsClick()
|
||||
}
|
||||
.padding(2.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when (state.sendState) {
|
||||
LocalEventSendState.NotSentYet,
|
||||
is LocalEventSendState.SendingFailed.Recoverable -> {
|
||||
LocalEventSendState.Sending -> {
|
||||
ReadReceiptsRow(modifier) {
|
||||
Icon(
|
||||
modifier = Modifier.padding(2.dp),
|
||||
|
|
@ -92,7 +91,7 @@ fun TimelineItemReadReceiptView(
|
|||
)
|
||||
}
|
||||
}
|
||||
is LocalEventSendState.SendingFailed.Unrecoverable -> {
|
||||
is LocalEventSendState.Failed -> {
|
||||
// Error? The timestamp is already displayed in red
|
||||
}
|
||||
null,
|
||||
|
|
@ -119,9 +118,9 @@ private fun ReadReceiptsRow(
|
|||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.height(AvatarSize.TimelineReadReceipt.dp + 8.dp)
|
||||
.padding(horizontal = 18.dp),
|
||||
.fillMaxWidth()
|
||||
.height(AvatarSize.TimelineReadReceipt.dp + 8.dp)
|
||||
.padding(horizontal = 18.dp),
|
||||
horizontalArrangement = Arrangement.End,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
|
|
@ -160,11 +159,11 @@ private fun ReadReceiptsAvatars(
|
|||
.forEachIndexed { index, readReceiptData ->
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(end = (12.dp + avatarStrokeSize * 2) * index)
|
||||
.size(size = avatarSize + avatarStrokeSize * 2)
|
||||
.clip(CircleShape)
|
||||
.background(avatarStrokeColor)
|
||||
.zIndex(index.toFloat()),
|
||||
.padding(end = (12.dp + avatarStrokeSize * 2) * index)
|
||||
.size(size = avatarSize + avatarStrokeSize * 2)
|
||||
.clip(CircleShape)
|
||||
.background(avatarStrokeColor)
|
||||
.zIndex(index.toFloat()),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Avatar(
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ sealed interface TimelineItem {
|
|||
|
||||
val safeSenderName: String = senderProfile.getDisambiguatedDisplayName(senderId)
|
||||
|
||||
val failedToSend: Boolean = localSendState is LocalEventSendState.SendingFailed
|
||||
val failedToSend: Boolean = localSendState is LocalEventSendState.Failed
|
||||
|
||||
val isTextMessage: Boolean = content is TimelineItemTextBasedContent
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue