Browse Source

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

pull/2939/head
Jorge Martin Espinosa 4 months ago committed by GitHub
parent
commit
a1adc7476d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      gradle/libs.versions.toml
  2. 9
      libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationData.kt
  3. 8
      libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt
  4. 3
      libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomSyncSubscriber.kt
  5. 4
      libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotifiableEventResolver.kt

2
gradle/libs.versions.toml

@ -156,7 +156,7 @@ jsoup = "org.jsoup:jsoup:1.17.2" @@ -156,7 +156,7 @@ jsoup = "org.jsoup:jsoup:1.17.2"
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
molecule-runtime = "app.cash.molecule:molecule-runtime:1.4.3"
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_compose = { module = "io.element.android:wysiwyg-compose", version.ref = "wysiwyg" }
sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" }

9
libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationData.kt

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

8
libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt

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

3
libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomSyncSubscriber.kt

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

4
libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/DefaultNotifiableEventResolver.kt

@ -150,8 +150,10 @@ class DefaultNotifiableEventResolver @Inject constructor( @@ -150,8 +150,10 @@ class DefaultNotifiableEventResolver @Inject constructor(
}
NotificationContent.MessageLike.CallAnswer,
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}")
null
}
is NotificationContent.MessageLike.CallInvite -> {
buildNotifiableMessageEvent(

Loading…
Cancel
Save