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
|
|
@ -53,6 +53,7 @@ sealed interface NotificationContent {
|
|||
data class CallInvite(
|
||||
val senderId: UserId,
|
||||
) : MessageLike
|
||||
|
||||
data class CallNotify(
|
||||
val senderId: UserId,
|
||||
val type: CallNotifyType,
|
||||
|
|
@ -77,7 +78,11 @@ sealed interface NotificationContent {
|
|||
val messageType: MessageType
|
||||
) : MessageLike
|
||||
|
||||
data object RoomRedaction : MessageLike
|
||||
data class RoomRedaction(
|
||||
val redactedEventId: String?,
|
||||
val reason: String?
|
||||
) : MessageLike
|
||||
|
||||
data object Sticker : MessageLike
|
||||
data class Poll(
|
||||
val senderId: UserId,
|
||||
|
|
|
|||
|
|
@ -18,13 +18,27 @@ package io.element.android.libraries.matrix.api.timeline.item.event
|
|||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
|
||||
@Immutable
|
||||
sealed interface LocalEventSendState {
|
||||
data object NotSentYet : LocalEventSendState
|
||||
sealed class SendingFailed(open val error: String) : LocalEventSendState {
|
||||
data class Recoverable(override val error: String) : SendingFailed(error)
|
||||
data class Unrecoverable(override val error: String) : SendingFailed(error)
|
||||
data object Sending : LocalEventSendState
|
||||
sealed interface Failed : LocalEventSendState {
|
||||
data class Unknown(val error: String) : Failed
|
||||
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(
|
||||
val eventId: EventId
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ sealed interface MessageShield {
|
|||
|
||||
/** An unencrypted event in an encrypted room. */
|
||||
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
|
||||
|
|
@ -43,4 +46,5 @@ val MessageShield.isCritical: Boolean
|
|||
is MessageShield.UnsignedDevice -> isCritical
|
||||
is MessageShield.UnverifiedIdentity -> isCritical
|
||||
is MessageShield.SentInClear -> isCritical
|
||||
is MessageShield.PreviouslyVerified -> isCritical
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,8 @@ class RustMatrixClientFactory @Inject constructor(
|
|||
slidingSync: ClientBuilderSlidingSync,
|
||||
): 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)
|
||||
.slidingSyncProxy(slidingSyncProxy)
|
||||
.userAgent(userAgentProvider.provide())
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
|
|||
is MessageLikeEventContent.RoomMessage -> {
|
||||
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
|
||||
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(senderId, question)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class MatrixRoomInfoMapper {
|
|||
userPowerLevels = mapPowerLevels(it.userPowerLevels),
|
||||
highlightCount = it.highlightCount.toLong(),
|
||||
notificationCount = it.notificationCount.toLong(),
|
||||
userDefinedNotificationMode = it.userDefinedNotificationMode?.map(),
|
||||
userDefinedNotificationMode = it.cachedUserDefinedNotificationMode?.map(),
|
||||
hasRoomCall = it.hasRoomCall,
|
||||
activeRoomCallParticipants = it.activeRoomCallParticipants.toImmutableList(),
|
||||
heroes = it.elementHeroes().toImmutableList(),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class RoomSummaryDetailsFactory(private val roomMessageFactory: RoomMessageFacto
|
|||
isMarkedUnread = roomInfo.isMarkedUnread,
|
||||
lastMessage = latestRoomMessage,
|
||||
inviter = roomInfo.inviter?.let(RoomMemberMapper::map),
|
||||
userDefinedNotificationMode = roomInfo.userDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||
userDefinedNotificationMode = roomInfo.cachedUserDefinedNotificationMode?.let(RoomNotificationSettingsMapper::mapMode),
|
||||
hasRoomCall = roomInfo.hasRoomCall,
|
||||
isDm = isDm(isDirect = roomInfo.isDirect, activeMembersCount = roomInfo.activeMembersCount.toInt()),
|
||||
isFavorite = roomInfo.isFavourite,
|
||||
|
|
|
|||
|
|
@ -81,15 +81,23 @@ fun RustProfileDetails.map(): ProfileTimelineDetails {
|
|||
fun RustEventSendState?.map(): LocalEventSendState? {
|
||||
return when (this) {
|
||||
null -> null
|
||||
RustEventSendState.NotSentYet -> LocalEventSendState.NotSentYet
|
||||
RustEventSendState.NotSentYet -> LocalEventSendState.Sending
|
||||
is RustEventSendState.SendingFailed -> {
|
||||
if (this.isRecoverable) {
|
||||
LocalEventSendState.SendingFailed.Recoverable(this.error)
|
||||
if (isRecoverable) {
|
||||
LocalEventSendState.Sending
|
||||
} else {
|
||||
LocalEventSendState.SendingFailed.Unrecoverable(this.error)
|
||||
LocalEventSendState.Failed.Unknown(error)
|
||||
}
|
||||
}
|
||||
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.UNVERIFIED_IDENTITY -> MessageShield.UnverifiedIdentity(isCritical)
|
||||
ShieldStateCode.SENT_IN_CLEAR -> MessageShield.SentInClear(isCritical)
|
||||
ShieldStateCode.PREVIOUSLY_VERIFIED -> MessageShield.PreviouslyVerified(isCritical)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ private fun aRustRoomInfo(
|
|||
userPowerLevels = userPowerLevels,
|
||||
highlightCount = highlightCount,
|
||||
notificationCount = notificationCount,
|
||||
userDefinedNotificationMode = userDefinedNotificationMode,
|
||||
cachedUserDefinedNotificationMode = userDefinedNotificationMode,
|
||||
hasRoomCall = hasRoomCall,
|
||||
activeRoomCallParticipants = activeRoomCallParticipants,
|
||||
isMarkedUnread = isMarkedUnread,
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ class DefaultNotifiableEventResolver @Inject constructor(
|
|||
NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also {
|
||||
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")
|
||||
}
|
||||
NotificationContent.MessageLike.Sticker -> null.also {
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ class DefaultNotifiableEventResolverTest {
|
|||
testNull(NotificationContent.MessageLike.KeyVerificationMac)
|
||||
testNull(NotificationContent.MessageLike.KeyVerificationDone)
|
||||
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.StateEvent.PolicyRuleRoom)
|
||||
testNull(NotificationContent.StateEvent.PolicyRuleServer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue