Prepare update to Rust SDK 0.1.36 (#966)

* Update to Rust SDK 0.1.36

* Cancel fetching members when the we exit the room
This commit is contained in:
Jorge Martin Espinosa 2023-07-26 16:22:09 +02:00 committed by GitHub
parent 1806ebaa02
commit 05f7037939
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 99 additions and 55 deletions

View file

@ -22,6 +22,7 @@ import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.core.ThreadId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.notification.NotificationContent
import io.element.android.libraries.matrix.api.notification.NotificationData
import io.element.android.libraries.matrix.api.room.RoomMembershipState
@ -81,18 +82,18 @@ class NotifiableEventResolver @Inject constructor(
}
private fun NotificationData.asNotifiableEvent(userId: SessionId): NotifiableEvent? {
return when (val content = this.event.content) {
return when (val content = this.content) {
is NotificationContent.MessageLike.RoomMessage -> {
buildNotifiableMessageEvent(
sessionId = userId,
senderId = content.senderId,
roomId = roomId,
eventId = eventId,
noisy = isNoisy,
timestamp = event.timestamp,
timestamp = this.timestamp,
senderName = senderDisplayName,
senderId = senderId.value,
body = descriptionFromMessageContent(content),
imageUriString = event.contentUrl,
imageUriString = this.contentUrl,
roomName = roomDisplayName,
roomIsDirect = isDirect,
roomAvatarPath = roomAvatarUrl,
@ -109,7 +110,7 @@ class NotifiableEventResolver @Inject constructor(
canBeReplaced = true,
roomName = roomDisplayName,
noisy = isNoisy,
timestamp = event.timestamp,
timestamp = this.timestamp,
soundName = null,
isRedacted = false,
isUpdated = false,
@ -177,6 +178,7 @@ class NotifiableEventResolver @Inject constructor(
@Suppress("LongParameterList")
private fun buildNotifiableMessageEvent(
sessionId: SessionId,
senderId: UserId,
roomId: RoomId,
eventId: EventId,
editedEventId: EventId? = null,
@ -184,7 +186,6 @@ private fun buildNotifiableMessageEvent(
noisy: Boolean,
timestamp: Long,
senderName: String?,
senderId: String?,
body: String?,
// We cannot use Uri? type here, as that could trigger a
// NotSerializableException when persisting this to storage
@ -202,6 +203,7 @@ private fun buildNotifiableMessageEvent(
isUpdated: Boolean = false
) = NotifiableMessageEvent(
sessionId = sessionId,
senderId = senderId,
roomId = roomId,
eventId = eventId,
editedEventId = editedEventId,
@ -209,7 +211,6 @@ private fun buildNotifiableMessageEvent(
noisy = noisy,
timestamp = timestamp,
senderName = senderName,
senderId = senderId,
body = body,
imageUriString = imageUriString,
threadId = threadId,

View file

@ -108,7 +108,7 @@ class RoomGroupMessageCreator @Inject constructor(
Person.Builder()
.setName(event.senderName?.annotateForDebug(70))
.setIcon(bitmapLoader.getUserIcon(event.senderAvatarPath))
.setKey(event.senderId)
.setKey(event.senderId.value)
.build()
}
when {

View file

@ -20,6 +20,7 @@ import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.core.ThreadId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.api.timeline.item.event.EventType
import io.element.android.services.appnavstate.api.AppNavigationState
import io.element.android.services.appnavstate.api.currentRoomId
@ -32,10 +33,10 @@ data class NotifiableMessageEvent(
override val eventId: EventId,
override val editedEventId: EventId?,
override val canBeReplaced: Boolean,
val senderId: UserId,
val noisy: Boolean,
val timestamp: Long,
val senderName: String?,
val senderId: String?,
val body: String?,
// We cannot use Uri? type here, as that could trigger a
// NotSerializableException when persisting this to storage

View file

@ -20,6 +20,7 @@ import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.RoomId
import io.element.android.libraries.matrix.api.core.SessionId
import io.element.android.libraries.matrix.api.core.ThreadId
import io.element.android.libraries.matrix.api.core.UserId
import io.element.android.libraries.matrix.test.AN_EVENT_ID
import io.element.android.libraries.matrix.test.A_ROOM_ID
import io.element.android.libraries.matrix.test.A_SESSION_ID
@ -84,7 +85,7 @@ fun aNotifiableMessageEvent(
noisy = false,
timestamp = 0,
senderName = "sender-name",
senderId = "sending-id",
senderId = UserId("@sending-id:domain.com"),
body = "message-body",
roomId = roomId,
threadId = threadId,