Bump Matrix Rust SDK to v0.2.21 and fix conflicts (#2938)

This commit is contained in:
Jorge Martin Espinosa 2024-05-29 13:12:44 +02:00 committed by GitHub
parent 45188aea03
commit 3d52071c45
5 changed files with 23 additions and 3 deletions

View file

@ -156,7 +156,7 @@ jsoup = "org.jsoup:jsoup:1.17.2"
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:1.4.3" molecule-runtime = "app.cash.molecule:molecule-runtime:1.4.3"
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.20" matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.21"
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" }

View file

@ -52,6 +52,10 @@ sealed interface NotificationContent {
data class CallInvite( data class CallInvite(
val senderId: UserId, val senderId: UserId,
) : MessageLike ) : MessageLike
data class CallNotify(
val senderId: UserId,
val type: CallNotifyType,
) : MessageLike
data object CallHangup : MessageLike data object CallHangup : MessageLike
data object CallCandidates : MessageLike data object CallCandidates : MessageLike
@ -108,3 +112,8 @@ sealed interface NotificationContent {
data object SpaceParent : StateEvent data object SpaceParent : StateEvent
} }
} }
enum class CallNotifyType {
RING,
NOTIFY
}

View file

@ -17,10 +17,12 @@
package io.element.android.libraries.matrix.impl.notification package io.element.android.libraries.matrix.impl.notification
import io.element.android.libraries.matrix.api.core.UserId import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.notification.CallNotifyType
import io.element.android.libraries.matrix.api.notification.NotificationContent import io.element.android.libraries.matrix.api.notification.NotificationContent
import io.element.android.libraries.matrix.impl.room.member.RoomMemberMapper import io.element.android.libraries.matrix.impl.room.member.RoomMemberMapper
import io.element.android.libraries.matrix.impl.timeline.item.event.EventMessageMapper import io.element.android.libraries.matrix.impl.timeline.item.event.EventMessageMapper
import org.matrix.rustcomponents.sdk.MessageLikeEventContent import org.matrix.rustcomponents.sdk.MessageLikeEventContent
import org.matrix.rustcomponents.sdk.NotifyType
import org.matrix.rustcomponents.sdk.StateEventContent import org.matrix.rustcomponents.sdk.StateEventContent
import org.matrix.rustcomponents.sdk.TimelineEvent import org.matrix.rustcomponents.sdk.TimelineEvent
import org.matrix.rustcomponents.sdk.TimelineEventType import org.matrix.rustcomponents.sdk.TimelineEventType
@ -79,6 +81,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
MessageLikeEventContent.CallCandidates -> NotificationContent.MessageLike.CallCandidates MessageLikeEventContent.CallCandidates -> NotificationContent.MessageLike.CallCandidates
MessageLikeEventContent.CallHangup -> NotificationContent.MessageLike.CallHangup MessageLikeEventContent.CallHangup -> NotificationContent.MessageLike.CallHangup
MessageLikeEventContent.CallInvite -> NotificationContent.MessageLike.CallInvite(senderId) MessageLikeEventContent.CallInvite -> NotificationContent.MessageLike.CallInvite(senderId)
is MessageLikeEventContent.CallNotify -> NotificationContent.MessageLike.CallNotify(senderId, notifyType.map())
MessageLikeEventContent.KeyVerificationAccept -> NotificationContent.MessageLike.KeyVerificationAccept MessageLikeEventContent.KeyVerificationAccept -> NotificationContent.MessageLike.KeyVerificationAccept
MessageLikeEventContent.KeyVerificationCancel -> NotificationContent.MessageLike.KeyVerificationCancel MessageLikeEventContent.KeyVerificationCancel -> NotificationContent.MessageLike.KeyVerificationCancel
MessageLikeEventContent.KeyVerificationDone -> NotificationContent.MessageLike.KeyVerificationDone MessageLikeEventContent.KeyVerificationDone -> NotificationContent.MessageLike.KeyVerificationDone
@ -97,3 +100,8 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
} }
} }
} }
private fun NotifyType.map(): CallNotifyType = when (this) {
NotifyType.NOTIFY -> CallNotifyType.NOTIFY
NotifyType.RING -> CallNotifyType.RING
}

View file

@ -41,7 +41,8 @@ class RoomSyncSubscriber(
RequiredState(key = EventType.STATE_ROOM_JOIN_RULES, value = ""), RequiredState(key = EventType.STATE_ROOM_JOIN_RULES, value = ""),
RequiredState(key = EventType.STATE_ROOM_POWER_LEVELS, value = ""), RequiredState(key = EventType.STATE_ROOM_POWER_LEVELS, value = ""),
), ),
timelineLimit = null timelineLimit = null,
includeHeroes = true,
) )
suspend fun subscribe(roomId: RoomId) = mutex.withLock { suspend fun subscribe(roomId: RoomId) = mutex.withLock {

View file

@ -150,8 +150,10 @@ class DefaultNotifiableEventResolver @Inject constructor(
} }
NotificationContent.MessageLike.CallAnswer, NotificationContent.MessageLike.CallAnswer,
NotificationContent.MessageLike.CallCandidates, NotificationContent.MessageLike.CallCandidates,
NotificationContent.MessageLike.CallHangup -> null.also { NotificationContent.MessageLike.CallHangup,
is NotificationContent.MessageLike.CallNotify -> { // TODO CallNotify will be handled separately in the future
Timber.tag(loggerTag.value).d("Ignoring notification for call ${content.javaClass.simpleName}") Timber.tag(loggerTag.value).d("Ignoring notification for call ${content.javaClass.simpleName}")
null
} }
is NotificationContent.MessageLike.CallInvite -> { is NotificationContent.MessageLike.CallInvite -> {
buildNotifiableMessageEvent( buildNotifiableMessageEvent(