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
9939c43f36
22 changed files with 87 additions and 52 deletions
|
|
@ -84,7 +84,7 @@ internal fun aTimelineItemList(content: TimelineItemEventContent): ImmutableList
|
||||||
isMine = false,
|
isMine = false,
|
||||||
content = content,
|
content = content,
|
||||||
groupPosition = TimelineItemGroupPosition.Middle,
|
groupPosition = TimelineItemGroupPosition.Middle,
|
||||||
sendState = LocalEventSendState.SendingFailed.Unrecoverable("Message failed to send"),
|
sendState = LocalEventSendState.Failed.Unknown("Message failed to send"),
|
||||||
),
|
),
|
||||||
aTimelineItemEvent(
|
aTimelineItemEvent(
|
||||||
isMine = false,
|
isMine = false,
|
||||||
|
|
@ -107,7 +107,7 @@ internal fun aTimelineItemList(content: TimelineItemEventContent): ImmutableList
|
||||||
isMine = true,
|
isMine = true,
|
||||||
content = content,
|
content = content,
|
||||||
groupPosition = TimelineItemGroupPosition.Middle,
|
groupPosition = TimelineItemGroupPosition.Middle,
|
||||||
sendState = LocalEventSendState.SendingFailed.Unrecoverable("Message failed to send"),
|
sendState = LocalEventSendState.Failed.Unknown("Message failed to send"),
|
||||||
),
|
),
|
||||||
aTimelineItemEvent(
|
aTimelineItemEvent(
|
||||||
isMine = true,
|
isMine = true,
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ internal fun MessageShield.toText(): String {
|
||||||
is MessageShield.UnsignedDevice -> CommonStrings.event_shield_reason_unsigned_device
|
is MessageShield.UnsignedDevice -> CommonStrings.event_shield_reason_unsigned_device
|
||||||
is MessageShield.UnverifiedIdentity -> CommonStrings.event_shield_reason_unverified_identity
|
is MessageShield.UnverifiedIdentity -> CommonStrings.event_shield_reason_unverified_identity
|
||||||
is MessageShield.SentInClear -> CommonStrings.event_shield_reason_sent_in_clear
|
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.AuthenticityNotGuaranteed -> CompoundIcons.Info()
|
||||||
is MessageShield.UnknownDevice,
|
is MessageShield.UnknownDevice,
|
||||||
is MessageShield.UnsignedDevice,
|
is MessageShield.UnsignedDevice,
|
||||||
is MessageShield.UnverifiedIdentity -> CompoundIcons.HelpSolid()
|
is MessageShield.UnverifiedIdentity,
|
||||||
|
is MessageShield.PreviouslyVerified -> CompoundIcons.HelpSolid()
|
||||||
is MessageShield.SentInClear -> CompoundIcons.LockOff()
|
is MessageShield.SentInClear -> CompoundIcons.LockOff()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -126,6 +128,9 @@ internal fun MessageShieldViewPreview() {
|
||||||
MessageShieldView(
|
MessageShieldView(
|
||||||
shield = MessageShield.SentInClear(false)
|
shield = MessageShield.SentInClear(false)
|
||||||
)
|
)
|
||||||
|
MessageShieldView(
|
||||||
|
shield = MessageShield.PreviouslyVerified(false)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ fun TimelineEventTimestampView(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val formattedTime = event.sentTime
|
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 hasEncryptionCritical = event.messageShield?.isCritical.orFalse()
|
||||||
val isMessageEdited = event.content.isEdited()
|
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(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(PaddingValues(start = TimelineEventTimestampViewDefaults.spacing))
|
.padding(PaddingValues(start = TimelineEventTimestampViewDefaults.spacing))
|
||||||
|
|
@ -74,7 +74,7 @@ fun TimelineEventTimestampView(
|
||||||
style = ElementTheme.typography.fontBodyXsRegular,
|
style = ElementTheme.typography.fontBodyXsRegular,
|
||||||
color = tint,
|
color = tint,
|
||||||
)
|
)
|
||||||
if (hasUnrecoverableError) {
|
if (hasError) {
|
||||||
Spacer(modifier = Modifier.width(2.dp))
|
Spacer(modifier = Modifier.width(2.dp))
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = CompoundIcons.Error(),
|
imageVector = CompoundIcons.Error(),
|
||||||
|
|
|
||||||
|
|
@ -27,15 +27,13 @@ class TimelineItemEventForTimestampViewProvider : PreviewParameterProvider<Timel
|
||||||
override val values: Sequence<TimelineItem.Event>
|
override val values: Sequence<TimelineItem.Event>
|
||||||
get() = sequenceOf(
|
get() = sequenceOf(
|
||||||
aTimelineItemEvent(),
|
aTimelineItemEvent(),
|
||||||
// Sending failed recoverable
|
aTimelineItemEvent().copy(localSendState = LocalEventSendState.Sending),
|
||||||
aTimelineItemEvent().copy(localSendState = LocalEventSendState.SendingFailed.Recoverable("AN_ERROR")),
|
aTimelineItemEvent().copy(localSendState = LocalEventSendState.Failed.Unknown("AN_ERROR")),
|
||||||
// Sending failed unrecoverable
|
|
||||||
aTimelineItemEvent().copy(localSendState = LocalEventSendState.SendingFailed.Unrecoverable("AN_ERROR")),
|
|
||||||
// Edited
|
// Edited
|
||||||
aTimelineItemEvent().copy(content = aTimelineItemTextContent().copy(isEdited = true)),
|
aTimelineItemEvent().copy(content = aTimelineItemTextContent().copy(isEdited = true)),
|
||||||
// Sending failed + Edited (not sure this is possible IRL, but should be covered by test)
|
// Sending failed + Edited (not sure this is possible IRL, but should be covered by test)
|
||||||
aTimelineItemEvent().copy(
|
aTimelineItemEvent().copy(
|
||||||
localSendState = LocalEventSendState.SendingFailed.Unrecoverable("AN_ERROR"),
|
localSendState = LocalEventSendState.Failed.Unknown("AN_ERROR"),
|
||||||
content = aTimelineItemTextContent().copy(isEdited = true),
|
content = aTimelineItemTextContent().copy(isEdited = true),
|
||||||
),
|
),
|
||||||
aTimelineItemEvent().copy(
|
aTimelineItemEvent().copy(
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class ReadReceiptViewStateForTimelineItemEventRowProvider :
|
||||||
override val values: Sequence<ReadReceiptViewState>
|
override val values: Sequence<ReadReceiptViewState>
|
||||||
get() = sequenceOf(
|
get() = sequenceOf(
|
||||||
aReadReceiptViewState(
|
aReadReceiptViewState(
|
||||||
sendState = LocalEventSendState.NotSentYet
|
sendState = LocalEventSendState.Sending,
|
||||||
),
|
),
|
||||||
aReadReceiptViewState(
|
aReadReceiptViewState(
|
||||||
sendState = LocalEventSendState.Sent(EventId("\$eventId")),
|
sendState = LocalEventSendState.Sent(EventId("\$eventId")),
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class ReadReceiptViewStateProvider : PreviewParameterProvider<ReadReceiptViewSta
|
||||||
override val values: Sequence<ReadReceiptViewState>
|
override val values: Sequence<ReadReceiptViewState>
|
||||||
get() = sequenceOf(
|
get() = sequenceOf(
|
||||||
aReadReceiptViewState(),
|
aReadReceiptViewState(),
|
||||||
aReadReceiptViewState(sendState = LocalEventSendState.NotSentYet),
|
aReadReceiptViewState(sendState = LocalEventSendState.Sending),
|
||||||
aReadReceiptViewState(sendState = LocalEventSendState.Sent(EventId("\$eventId"))),
|
aReadReceiptViewState(sendState = LocalEventSendState.Sent(EventId("\$eventId"))),
|
||||||
aReadReceiptViewState(
|
aReadReceiptViewState(
|
||||||
sendState = LocalEventSendState.Sent(EventId("\$eventId")),
|
sendState = LocalEventSendState.Sent(EventId("\$eventId")),
|
||||||
|
|
|
||||||
|
|
@ -70,19 +70,18 @@ fun TimelineItemReadReceiptView(
|
||||||
ReadReceiptsAvatars(
|
ReadReceiptsAvatars(
|
||||||
receipts = state.receipts,
|
receipts = state.receipts,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.testTag(TestTags.messageReadReceipts)
|
.testTag(TestTags.messageReadReceipts)
|
||||||
.clip(RoundedCornerShape(4.dp))
|
.clip(RoundedCornerShape(4.dp))
|
||||||
.clickable {
|
.clickable {
|
||||||
onReadReceiptsClick()
|
onReadReceiptsClick()
|
||||||
}
|
}
|
||||||
.padding(2.dp)
|
.padding(2.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
when (state.sendState) {
|
when (state.sendState) {
|
||||||
LocalEventSendState.NotSentYet,
|
LocalEventSendState.Sending -> {
|
||||||
is LocalEventSendState.SendingFailed.Recoverable -> {
|
|
||||||
ReadReceiptsRow(modifier) {
|
ReadReceiptsRow(modifier) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.padding(2.dp),
|
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
|
// Error? The timestamp is already displayed in red
|
||||||
}
|
}
|
||||||
null,
|
null,
|
||||||
|
|
@ -119,9 +118,9 @@ private fun ReadReceiptsRow(
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(AvatarSize.TimelineReadReceipt.dp + 8.dp)
|
.height(AvatarSize.TimelineReadReceipt.dp + 8.dp)
|
||||||
.padding(horizontal = 18.dp),
|
.padding(horizontal = 18.dp),
|
||||||
horizontalArrangement = Arrangement.End,
|
horizontalArrangement = Arrangement.End,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
) {
|
) {
|
||||||
|
|
@ -160,11 +159,11 @@ private fun ReadReceiptsAvatars(
|
||||||
.forEachIndexed { index, readReceiptData ->
|
.forEachIndexed { index, readReceiptData ->
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(end = (12.dp + avatarStrokeSize * 2) * index)
|
.padding(end = (12.dp + avatarStrokeSize * 2) * index)
|
||||||
.size(size = avatarSize + avatarStrokeSize * 2)
|
.size(size = avatarSize + avatarStrokeSize * 2)
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.background(avatarStrokeColor)
|
.background(avatarStrokeColor)
|
||||||
.zIndex(index.toFloat()),
|
.zIndex(index.toFloat()),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Avatar(
|
Avatar(
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ sealed interface TimelineItem {
|
||||||
|
|
||||||
val safeSenderName: String = senderProfile.getDisambiguatedDisplayName(senderId)
|
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
|
val isTextMessage: Boolean = content is TimelineItemTextBasedContent
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
|
||||||
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
|
||||||
molecule-runtime = "app.cash.molecule:molecule-runtime:2.0.0"
|
molecule-runtime = "app.cash.molecule:molecule-runtime:2.0.0"
|
||||||
timber = "com.jakewharton.timber:timber:5.0.1"
|
timber = "com.jakewharton.timber:timber:5.0.1"
|
||||||
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.39"
|
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.40"
|
||||||
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
|
matrix_richtexteditor = { module = "io.element.android:wysiwyg", version.ref = "wysiwyg" }
|
||||||
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
|
matrix_richtexteditor_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
|
||||||
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
|
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ sealed interface NotificationContent {
|
||||||
data class CallInvite(
|
data class CallInvite(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
) : MessageLike
|
) : MessageLike
|
||||||
|
|
||||||
data class CallNotify(
|
data class CallNotify(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
val type: CallNotifyType,
|
val type: CallNotifyType,
|
||||||
|
|
@ -77,7 +78,11 @@ sealed interface NotificationContent {
|
||||||
val messageType: MessageType
|
val messageType: MessageType
|
||||||
) : MessageLike
|
) : MessageLike
|
||||||
|
|
||||||
data object RoomRedaction : MessageLike
|
data class RoomRedaction(
|
||||||
|
val redactedEventId: String?,
|
||||||
|
val reason: String?
|
||||||
|
) : MessageLike
|
||||||
|
|
||||||
data object Sticker : MessageLike
|
data object Sticker : MessageLike
|
||||||
data class Poll(
|
data class Poll(
|
||||||
val senderId: UserId,
|
val senderId: UserId,
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,27 @@ package io.element.android.libraries.matrix.api.timeline.item.event
|
||||||
|
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import io.element.android.libraries.matrix.api.core.EventId
|
import io.element.android.libraries.matrix.api.core.EventId
|
||||||
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
sealed interface LocalEventSendState {
|
sealed interface LocalEventSendState {
|
||||||
data object NotSentYet : LocalEventSendState
|
data object Sending : LocalEventSendState
|
||||||
sealed class SendingFailed(open val error: String) : LocalEventSendState {
|
sealed interface Failed : LocalEventSendState {
|
||||||
data class Recoverable(override val error: String) : SendingFailed(error)
|
data class Unknown(val error: String) : Failed
|
||||||
data class Unrecoverable(override val error: String) : SendingFailed(error)
|
data class VerifiedUserHasUnsignedDevice(
|
||||||
|
/**
|
||||||
|
* The unsigned devices belonging to verified users. A map from user ID
|
||||||
|
* to a list of device IDs.
|
||||||
|
*/
|
||||||
|
val devices: Map<UserId, List<String>>
|
||||||
|
) : Failed
|
||||||
|
|
||||||
|
data class VerifiedUserChangedIdentity(
|
||||||
|
/**
|
||||||
|
* The users that were previously verified but are no longer.
|
||||||
|
*/
|
||||||
|
val users: List<UserId>
|
||||||
|
) : Failed
|
||||||
}
|
}
|
||||||
data class Sent(
|
data class Sent(
|
||||||
val eventId: EventId
|
val eventId: EventId
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ sealed interface MessageShield {
|
||||||
|
|
||||||
/** An unencrypted event in an encrypted room. */
|
/** An unencrypted event in an encrypted room. */
|
||||||
data class SentInClear(val isCritical: Boolean) : MessageShield
|
data class SentInClear(val isCritical: Boolean) : MessageShield
|
||||||
|
|
||||||
|
/** The sender was previously verified but changed their identity. */
|
||||||
|
data class PreviouslyVerified(val isCritical: Boolean) : MessageShield
|
||||||
}
|
}
|
||||||
|
|
||||||
val MessageShield.isCritical: Boolean
|
val MessageShield.isCritical: Boolean
|
||||||
|
|
@ -43,4 +46,5 @@ val MessageShield.isCritical: Boolean
|
||||||
is MessageShield.UnsignedDevice -> isCritical
|
is MessageShield.UnsignedDevice -> isCritical
|
||||||
is MessageShield.UnverifiedIdentity -> isCritical
|
is MessageShield.UnverifiedIdentity -> isCritical
|
||||||
is MessageShield.SentInClear -> isCritical
|
is MessageShield.SentInClear -> isCritical
|
||||||
|
is MessageShield.PreviouslyVerified -> isCritical
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,8 @@ class RustMatrixClientFactory @Inject constructor(
|
||||||
slidingSync: ClientBuilderSlidingSync,
|
slidingSync: ClientBuilderSlidingSync,
|
||||||
): ClientBuilder {
|
): ClientBuilder {
|
||||||
return ClientBuilder()
|
return ClientBuilder()
|
||||||
.sessionPath(sessionPath)
|
// TODO SDK claims it's valid to use the same path for data and cache, but would be better to use different paths
|
||||||
|
.sessionPaths(dataPath = sessionPath, cachePath = sessionPath)
|
||||||
.passphrase(passphrase)
|
.passphrase(passphrase)
|
||||||
.slidingSyncProxy(slidingSyncProxy)
|
.slidingSyncProxy(slidingSyncProxy)
|
||||||
.userAgent(userAgentProvider.provide())
|
.userAgent(userAgentProvider.provide())
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
|
||||||
is MessageLikeEventContent.RoomMessage -> {
|
is MessageLikeEventContent.RoomMessage -> {
|
||||||
NotificationContent.MessageLike.RoomMessage(senderId, EventMessageMapper().mapMessageType(messageType))
|
NotificationContent.MessageLike.RoomMessage(senderId, EventMessageMapper().mapMessageType(messageType))
|
||||||
}
|
}
|
||||||
MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction
|
is MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction(redactedEventId = redactedEventId, reason = reason)
|
||||||
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
|
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
|
||||||
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class MatrixRoomInfoMapper {
|
||||||
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
||||||
highlightCount = it.highlightCount.toLong(),
|
highlightCount = it.highlightCount.toLong(),
|
||||||
notificationCount = it.notificationCount.toLong(),
|
notificationCount = it.notificationCount.toLong(),
|
||||||
userDefinedNotificationMode = it.userDefinedNotificationMode?.map(),
|
userDefinedNotificationMode = it.cachedUserDefinedNotificationMode?.map(),
|
||||||
hasRoomCall = it.hasRoomCall,
|
hasRoomCall = it.hasRoomCall,
|
||||||
activeRoomCallParticipants = it.activeRoomCallParticipants.toImmutableList(),
|
activeRoomCallParticipants = it.activeRoomCallParticipants.toImmutableList(),
|
||||||
heroes = it.elementHeroes().toImmutableList(),
|
heroes = it.elementHeroes().toImmutableList(),
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
||||||
isMarkedUnread = roomInfo.isMarkedUnread,
|
isMarkedUnread = roomInfo.isMarkedUnread,
|
||||||
lastMessage = latestRoomMessage,
|
lastMessage = latestRoomMessage,
|
||||||
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
||||||
userDefinedNotificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
userDefinedNotificationMode = roomInfo.cachedUserDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||||
hasRoomCall = roomInfo.hasRoomCall,
|
hasRoomCall = roomInfo.hasRoomCall,
|
||||||
isDm = isDm(isDirect = roomInfo.isDirect, activeMembersCount = roomInfo.activeMembersCount.toInt()),
|
isDm = isDm(isDirect = roomInfo.isDirect, activeMembersCount = roomInfo.activeMembersCount.toInt()),
|
||||||
isFavorite = roomInfo.isFavourite,
|
isFavorite = roomInfo.isFavourite,
|
||||||
|
|
|
||||||
|
|
@ -81,15 +81,23 @@ fun RustProfileDetails.map(): ProfileTimelineDetails {
|
||||||
fun RustEventSendState?.map(): LocalEventSendState? {
|
fun RustEventSendState?.map(): LocalEventSendState? {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
null -> null
|
null -> null
|
||||||
RustEventSendState.NotSentYet -> LocalEventSendState.NotSentYet
|
RustEventSendState.NotSentYet -> LocalEventSendState.Sending
|
||||||
is RustEventSendState.SendingFailed -> {
|
is RustEventSendState.SendingFailed -> {
|
||||||
if (this.isRecoverable) {
|
if (isRecoverable) {
|
||||||
LocalEventSendState.SendingFailed.Recoverable(this.error)
|
LocalEventSendState.Sending
|
||||||
} else {
|
} else {
|
||||||
LocalEventSendState.SendingFailed.Unrecoverable(this.error)
|
LocalEventSendState.Failed.Unknown(error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is RustEventSendState.Sent -> LocalEventSendState.Sent(EventId(eventId))
|
is RustEventSendState.Sent -> LocalEventSendState.Sent(EventId(eventId))
|
||||||
|
is RustEventSendState.VerifiedUserChangedIdentity -> {
|
||||||
|
LocalEventSendState.Failed.VerifiedUserChangedIdentity(users.map { UserId(it) })
|
||||||
|
}
|
||||||
|
is RustEventSendState.VerifiedUserHasUnsignedDevice -> {
|
||||||
|
LocalEventSendState.Failed.VerifiedUserHasUnsignedDevice(
|
||||||
|
devices = devices.mapKeys { UserId(it.key) }
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,5 +160,6 @@ private fun ShieldState?.map(): MessageShield? {
|
||||||
ShieldStateCode.UNSIGNED_DEVICE -> MessageShield.UnsignedDevice(isCritical)
|
ShieldStateCode.UNSIGNED_DEVICE -> MessageShield.UnsignedDevice(isCritical)
|
||||||
ShieldStateCode.UNVERIFIED_IDENTITY -> MessageShield.UnverifiedIdentity(isCritical)
|
ShieldStateCode.UNVERIFIED_IDENTITY -> MessageShield.UnverifiedIdentity(isCritical)
|
||||||
ShieldStateCode.SENT_IN_CLEAR -> MessageShield.SentInClear(isCritical)
|
ShieldStateCode.SENT_IN_CLEAR -> MessageShield.SentInClear(isCritical)
|
||||||
|
ShieldStateCode.PREVIOUSLY_VERIFIED -> MessageShield.PreviouslyVerified(isCritical)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ private fun aRustRoomInfo(
|
||||||
userPowerLevels = userPowerLevels,
|
userPowerLevels = userPowerLevels,
|
||||||
highlightCount = highlightCount,
|
highlightCount = highlightCount,
|
||||||
notificationCount = notificationCount,
|
notificationCount = notificationCount,
|
||||||
userDefinedNotificationMode = userDefinedNotificationMode,
|
cachedUserDefinedNotificationMode = userDefinedNotificationMode,
|
||||||
hasRoomCall = hasRoomCall,
|
hasRoomCall = hasRoomCall,
|
||||||
activeRoomCallParticipants = activeRoomCallParticipants,
|
activeRoomCallParticipants = activeRoomCallParticipants,
|
||||||
isMarkedUnread = isMarkedUnread,
|
isMarkedUnread = isMarkedUnread,
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
|
||||||
NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also {
|
NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also {
|
||||||
Timber.tag(loggerTag.value).w("Notification with encrypted content -> fallback")
|
Timber.tag(loggerTag.value).w("Notification with encrypted content -> fallback")
|
||||||
}
|
}
|
||||||
NotificationContent.MessageLike.RoomRedaction -> null.also {
|
is NotificationContent.MessageLike.RoomRedaction -> null.also {
|
||||||
Timber.tag(loggerTag.value).d("Ignoring notification for redaction")
|
Timber.tag(loggerTag.value).d("Ignoring notification for redaction")
|
||||||
}
|
}
|
||||||
NotificationContent.MessageLike.Sticker -> null.also {
|
NotificationContent.MessageLike.Sticker -> null.also {
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,7 @@ class DefaultNotifiableEventResolverTest {
|
||||||
testNull(NotificationContent.MessageLike.KeyVerificationMac)
|
testNull(NotificationContent.MessageLike.KeyVerificationMac)
|
||||||
testNull(NotificationContent.MessageLike.KeyVerificationDone)
|
testNull(NotificationContent.MessageLike.KeyVerificationDone)
|
||||||
testNull(NotificationContent.MessageLike.ReactionContent(relatedEventId = AN_EVENT_ID_2.value))
|
testNull(NotificationContent.MessageLike.ReactionContent(relatedEventId = AN_EVENT_ID_2.value))
|
||||||
testNull(NotificationContent.MessageLike.RoomRedaction)
|
testNull(NotificationContent.MessageLike.RoomRedaction(redactedEventId = AN_EVENT_ID_2.value, reason = null))
|
||||||
testNull(NotificationContent.MessageLike.Sticker)
|
testNull(NotificationContent.MessageLike.Sticker)
|
||||||
testNull(NotificationContent.StateEvent.PolicyRuleRoom)
|
testNull(NotificationContent.StateEvent.PolicyRuleRoom)
|
||||||
testNull(NotificationContent.StateEvent.PolicyRuleServer)
|
testNull(NotificationContent.StateEvent.PolicyRuleServer)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:18808ed71ef0cbc10be0eda977ab077a0eaa83afbfd2ae50c500b802aa4c7976
|
oid sha256:df2ef6fe59cddc72475c85750cf76384056152c8271bc480748fde31e7d2ef13
|
||||||
size 30901
|
size 36201
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:1d0ad0c7f690d07d67a13fcad3ee8901a77602affe063d2f8222345de3aff934
|
oid sha256:a1ed76be54d00c0290b315b2322288d5bce83834c8b382b11b83bc4f82bb9cdc
|
||||||
size 30039
|
size 35103
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue