From 6ae44f17e406f4aed7aaefa0ea1147e9f772b78f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 26 Sep 2023 18:05:41 +0000 Subject: [PATCH 1/5] Update dependency org.matrix.rustcomponents:sdk-android to v0.1.58 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5e25c9f360..9f8af860fb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -150,7 +150,7 @@ jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" } molecule-runtime = { module = "app.cash.molecule:molecule-runtime", version.ref = "molecule" } timber = "com.jakewharton.timber:timber:5.0.1" -matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.57" +matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.58" 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 = "com.squareup.sqldelight:android-driver", version.ref = "sqldelight" } From 79f37f150452de61de0214c7a208f3321bff66ec Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 27 Sep 2023 09:40:25 +0200 Subject: [PATCH 2/5] Fix API break with Matrix SDK 0.1.58. --- .../api/notification/NotificationData.kt | 1 + ...imelineEventToNotificationContentMapper.kt | 1 + .../matrix/impl/room/RoomContentForwarder.kt | 3 +-- .../matrix/impl/room/RustMatrixRoom.kt | 19 +++++++------------ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationData.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationData.kt index 8565e4c747..290a54c502 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationData.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/notification/NotificationData.kt @@ -61,6 +61,7 @@ sealed interface NotificationContent { ) : MessageLike data object RoomRedaction : MessageLike data object Sticker : MessageLike + data class Poll(val question: String) : MessageLike } sealed interface StateEvent : NotificationContent { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt index e30e57113d..b82716cc2d 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/notification/TimelineEventToNotificationContentMapper.kt @@ -94,6 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon } MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker + is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(question) } } } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomContentForwarder.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomContentForwarder.kt index 8ee0361ace..d539ec6a53 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomContentForwarder.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RoomContentForwarder.kt @@ -27,7 +27,6 @@ import org.matrix.rustcomponents.sdk.Room import org.matrix.rustcomponents.sdk.RoomListService import org.matrix.rustcomponents.sdk.TimelineDiff import org.matrix.rustcomponents.sdk.TimelineListener -import org.matrix.rustcomponents.sdk.genTransactionId import kotlin.time.Duration.Companion.milliseconds /** @@ -61,7 +60,7 @@ class RoomContentForwarder( // Sending a message requires a registered timeline listener targetRoom.addTimelineListener(NoOpTimelineListener) withTimeout(timeoutMs.milliseconds) { - targetRoom.send(content, genTransactionId()) + targetRoom.send(content) } } // After sending, we remove the timeline diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt index 4a8a3f9bee..d879bcc53d 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt @@ -67,7 +67,6 @@ import org.matrix.rustcomponents.sdk.RoomMember import org.matrix.rustcomponents.sdk.RoomMessageEventContentWithoutRelation import org.matrix.rustcomponents.sdk.RoomSubscription import org.matrix.rustcomponents.sdk.SendAttachmentJoinHandle -import org.matrix.rustcomponents.sdk.genTransactionId import org.matrix.rustcomponents.sdk.messageEventContentFromHtml import org.matrix.rustcomponents.sdk.messageEventContentFromMarkdown import timber.log.Timber @@ -241,10 +240,9 @@ class RustMatrixRoom( } override suspend fun sendMessage(body: String, htmlBody: String?): Result = withContext(roomDispatcher) { - val transactionId = genTransactionId() messageEventContentFromParts(body, htmlBody).use { content -> runCatching { - innerRoom.send(content, transactionId) + innerRoom.send(content) } } } @@ -253,26 +251,27 @@ class RustMatrixRoom( withContext(roomDispatcher) { if (originalEventId != null) { runCatching { - innerRoom.edit(messageEventContentFromParts(body, htmlBody), originalEventId.value, transactionId?.value) + innerRoom.edit(messageEventContentFromParts(body, htmlBody), originalEventId.value) } } else { runCatching { transactionId?.let { cancelSend(it) } - innerRoom.send(messageEventContentFromParts(body, htmlBody), genTransactionId()) + innerRoom.send(messageEventContentFromParts(body, htmlBody)) } } } override suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result = withContext(roomDispatcher) { runCatching { - innerRoom.sendReply(messageEventContentFromParts(body, htmlBody), eventId.value, genTransactionId()) + innerRoom.getEventTimelineItemByEventId(eventId.value).use { eventTimelineItem -> + innerRoom.sendReply(messageEventContentFromParts(body, htmlBody), eventTimelineItem) + } } } override suspend fun redactEvent(eventId: EventId, reason: String?) = withContext(roomDispatcher) { - val transactionId = genTransactionId() runCatching { - innerRoom.redact(eventId.value, reason, transactionId) + innerRoom.redact(eventId.value, reason) } } @@ -416,7 +415,6 @@ class RustMatrixRoom( description = description, zoomLevel = zoomLevel?.toUByte(), assetType = assetType?.toInner(), - txnId = genTransactionId(), ) } } @@ -433,7 +431,6 @@ class RustMatrixRoom( answers = answers, maxSelections = maxSelections.toUByte(), pollKind = pollKind.toInner(), - txnId = genTransactionId(), ) } } @@ -446,7 +443,6 @@ class RustMatrixRoom( innerRoom.sendPollResponse( pollStartId = pollStartId.value, answers = answers, - txnId = genTransactionId(), ) } } @@ -459,7 +455,6 @@ class RustMatrixRoom( innerRoom.endPoll( pollStartId = pollStartId.value, text = text, - txnId = genTransactionId(), ) } } From 00ab22f42e57807e4b15a884d5408220231c1d2a Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 27 Sep 2023 10:12:04 +0200 Subject: [PATCH 3/5] Reduce the number of fallback notification. Only used now when message cannot be decrypted. Also avoid using `else` in this `when` block. --- .../notifications/NotifiableEventResolver.kt | 57 ++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt index c93d517e89..9951698b88 100644 --- a/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt +++ b/libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/NotifiableEventResolver.kt @@ -114,10 +114,63 @@ class NotifiableEventResolver @Inject constructor( title = null, // TODO check if title is needed anymore ) } else { - fallbackNotifiableEvent(userId, roomId, eventId) + Timber.tag(loggerTag.value).d("Ignoring notification state event for membership ${content.membershipState}") + null } } - else -> fallbackNotifiableEvent(userId, roomId, eventId) + NotificationContent.MessageLike.CallAnswer, + NotificationContent.MessageLike.CallCandidates, + NotificationContent.MessageLike.CallHangup, + NotificationContent.MessageLike.CallInvite -> null.also { + Timber.tag(loggerTag.value).d("Ignoring notification for call ${content.javaClass.simpleName}") + } + NotificationContent.MessageLike.KeyVerificationAccept, + NotificationContent.MessageLike.KeyVerificationCancel, + NotificationContent.MessageLike.KeyVerificationDone, + NotificationContent.MessageLike.KeyVerificationKey, + NotificationContent.MessageLike.KeyVerificationMac, + NotificationContent.MessageLike.KeyVerificationReady, + NotificationContent.MessageLike.KeyVerificationStart -> null.also { + Timber.tag(loggerTag.value).d("Ignoring notification for verification ${content.javaClass.simpleName}") + } + is NotificationContent.MessageLike.Poll -> null.also { + // TODO Polls: handle notification rendering + Timber.tag(loggerTag.value).d("Ignoring notification for poll") + } + is NotificationContent.MessageLike.ReactionContent -> null.also { + Timber.tag(loggerTag.value).d("Ignoring notification for reaction") + } + NotificationContent.MessageLike.RoomEncrypted -> fallbackNotifiableEvent(userId, roomId, eventId).also { + Timber.tag(loggerTag.value).w("Notification with encrypted content -> fallback") + } + NotificationContent.MessageLike.RoomRedaction -> null.also { + Timber.tag(loggerTag.value).d("Ignoring notification for redaction") + } + NotificationContent.MessageLike.Sticker -> null.also { + Timber.tag(loggerTag.value).d("Ignoring notification for sticker") + } + NotificationContent.StateEvent.PolicyRuleRoom, + NotificationContent.StateEvent.PolicyRuleServer, + NotificationContent.StateEvent.PolicyRuleUser, + NotificationContent.StateEvent.RoomAliases, + NotificationContent.StateEvent.RoomAvatar, + NotificationContent.StateEvent.RoomCanonicalAlias, + NotificationContent.StateEvent.RoomCreate, + NotificationContent.StateEvent.RoomEncryption, + NotificationContent.StateEvent.RoomGuestAccess, + NotificationContent.StateEvent.RoomHistoryVisibility, + NotificationContent.StateEvent.RoomJoinRules, + NotificationContent.StateEvent.RoomName, + NotificationContent.StateEvent.RoomPinnedEvents, + NotificationContent.StateEvent.RoomPowerLevels, + NotificationContent.StateEvent.RoomServerAcl, + NotificationContent.StateEvent.RoomThirdPartyInvite, + NotificationContent.StateEvent.RoomTombstone, + NotificationContent.StateEvent.RoomTopic, + NotificationContent.StateEvent.SpaceChild, + NotificationContent.StateEvent.SpaceParent -> null.also { + Timber.tag(loggerTag.value).d("Ignoring notification for state event ${content.javaClass.simpleName}") + } } } From 9d0e185d1ccaa0f4e2cadff7bdb5a1edfae6656d Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 27 Sep 2023 10:48:31 +0200 Subject: [PATCH 4/5] Ensure `getEventTimelineItemByEventId` is called when we enter in reply mode. --- .../MessageComposerPresenter.kt | 21 ++++++++++++++++-- .../libraries/matrix/api/room/MatrixRoom.kt | 7 +++--- .../matrix/impl/room/RustMatrixRoom.kt | 22 ++++++++++++++++++- .../matrix/test/room/FakeMatrixRoom.kt | 10 ++++++++- 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 6898d7796f..9a6849023f 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -20,6 +20,7 @@ import android.Manifest import android.annotation.SuppressLint import android.net.Uri import androidx.compose.runtime.Composable +import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue @@ -151,15 +152,24 @@ class MessageComposerPresenter @Inject constructor( } } + DisposableEffect(Unit) { + onDispose { + appCoroutineScope.launch { + room.exitReplyMode() + } + } + } + fun handleEvents(event: MessageComposerEvents) { when (event) { MessageComposerEvents.ToggleFullScreenState -> isFullScreen.value = !isFullScreen.value - MessageComposerEvents.CloseSpecialMode -> { richTextEditorState.setHtml("") messageComposerContext.composerMode = MessageComposerMode.Normal("") + appCoroutineScope.launch { + room.exitReplyMode() + } } - is MessageComposerEvents.SendMessage -> appCoroutineScope.sendMessage( message = event.message, updateComposerMode = { messageComposerContext.composerMode = it }, @@ -167,6 +177,13 @@ class MessageComposerPresenter @Inject constructor( ) is MessageComposerEvents.SetMode -> { messageComposerContext.composerMode = event.composerMode + appCoroutineScope.launch { + if (event.composerMode is MessageComposerMode.Reply) { + room.enterReplyMode(event.composerMode.eventId) + } else { + room.exitReplyMode() + } + } } MessageComposerEvents.AddAttachment -> localCoroutineScope.launch { showAttachmentSourcePicker = true diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt index 1dd6101354..465c0fe365 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt @@ -89,6 +89,10 @@ interface MatrixRoom : Closeable { suspend fun editMessage(originalEventId: EventId?, transactionId: TransactionId?, body: String, htmlBody: String?): Result + suspend fun enterReplyMode(eventId: EventId): Result + + suspend fun exitReplyMode(): Result + suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result suspend fun redactEvent(eventId: EventId, reason: String? = null): Result @@ -184,7 +188,4 @@ interface MatrixRoom : Closeable { suspend fun endPoll(pollStartId: EventId, text: String): Result override fun close() = destroy() - } - - diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt index d879bcc53d..a4cedfee91 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt @@ -60,6 +60,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.withContext +import org.matrix.rustcomponents.sdk.EventTimelineItem import org.matrix.rustcomponents.sdk.RequiredState import org.matrix.rustcomponents.sdk.Room import org.matrix.rustcomponents.sdk.RoomListItem @@ -261,11 +262,30 @@ class RustMatrixRoom( } } + private var inReplyToEventTimelineItem: EventTimelineItem? = null + + override suspend fun enterReplyMode(eventId: EventId): Result = withContext(roomDispatcher) { + runCatching { + inReplyToEventTimelineItem?.destroy() + inReplyToEventTimelineItem = null + inReplyToEventTimelineItem = innerRoom.getEventTimelineItemByEventId(eventId.value) + } + } + + override suspend fun exitReplyMode(): Result = withContext(roomDispatcher) { + runCatching { + inReplyToEventTimelineItem?.destroy() + inReplyToEventTimelineItem = null + } + } + override suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result = withContext(roomDispatcher) { runCatching { - innerRoom.getEventTimelineItemByEventId(eventId.value).use { eventTimelineItem -> + val inReplyTo = inReplyToEventTimelineItem ?: innerRoom.getEventTimelineItemByEventId(eventId.value) + inReplyTo.use { eventTimelineItem -> innerRoom.sendReply(messageEventContentFromParts(body, htmlBody), eventTimelineItem) } + inReplyToEventTimelineItem = null } } diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt index 0e8916e87e..7771548d01 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt @@ -31,8 +31,8 @@ import io.element.android.libraries.matrix.api.notificationsettings.Notification import io.element.android.libraries.matrix.api.poll.PollKind import io.element.android.libraries.matrix.api.room.MatrixRoom import io.element.android.libraries.matrix.api.room.MatrixRoomMembersState -import io.element.android.libraries.matrix.api.room.MessageEventType import io.element.android.libraries.matrix.api.room.MatrixRoomNotificationSettingsState +import io.element.android.libraries.matrix.api.room.MessageEventType import io.element.android.libraries.matrix.api.room.StateEventType import io.element.android.libraries.matrix.api.room.location.AssetType import io.element.android.libraries.matrix.api.timeline.MatrixTimeline @@ -208,6 +208,14 @@ class FakeMatrixRoom( var replyMessageParameter: Pair? = null private set + override suspend fun enterReplyMode(eventId: EventId): Result { + return Result.success(Unit) + } + + override suspend fun exitReplyMode(): Result { + return Result.success(Unit) + } + override suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result { replyMessageParameter = body to htmlBody return Result.success(Unit) From d32a7c6ddf970347eaef6a51598a228ea6ab0bb9 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 27 Sep 2023 11:25:23 +0200 Subject: [PATCH 5/5] Simplify the management of `inReplyToEventTimelineItem` --- .../MessageComposerPresenter.kt | 18 ++---------------- .../libraries/matrix/api/room/MatrixRoom.kt | 2 -- .../matrix/impl/room/RustMatrixRoom.kt | 8 +------- .../matrix/test/room/FakeMatrixRoom.kt | 4 ---- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt index 9a6849023f..d6e74a0df0 100644 --- a/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt +++ b/features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/messagecomposer/MessageComposerPresenter.kt @@ -20,7 +20,6 @@ import android.Manifest import android.annotation.SuppressLint import android.net.Uri import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.MutableState import androidx.compose.runtime.getValue @@ -152,23 +151,12 @@ class MessageComposerPresenter @Inject constructor( } } - DisposableEffect(Unit) { - onDispose { - appCoroutineScope.launch { - room.exitReplyMode() - } - } - } - fun handleEvents(event: MessageComposerEvents) { when (event) { MessageComposerEvents.ToggleFullScreenState -> isFullScreen.value = !isFullScreen.value MessageComposerEvents.CloseSpecialMode -> { richTextEditorState.setHtml("") messageComposerContext.composerMode = MessageComposerMode.Normal("") - appCoroutineScope.launch { - room.exitReplyMode() - } } is MessageComposerEvents.SendMessage -> appCoroutineScope.sendMessage( message = event.message, @@ -177,11 +165,9 @@ class MessageComposerPresenter @Inject constructor( ) is MessageComposerEvents.SetMode -> { messageComposerContext.composerMode = event.composerMode - appCoroutineScope.launch { - if (event.composerMode is MessageComposerMode.Reply) { + if (event.composerMode is MessageComposerMode.Reply) { + appCoroutineScope.launch { room.enterReplyMode(event.composerMode.eventId) - } else { - room.exitReplyMode() } } } diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt index 465c0fe365..17cb637d80 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/MatrixRoom.kt @@ -91,8 +91,6 @@ interface MatrixRoom : Closeable { suspend fun enterReplyMode(eventId: EventId): Result - suspend fun exitReplyMode(): Result - suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result suspend fun redactEvent(eventId: EventId, reason: String? = null): Result diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt index a4cedfee91..4c20dd4d0c 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt @@ -139,6 +139,7 @@ class RustMatrixRoom( roomCoroutineScope.cancel() innerRoom.destroy() roomListItem.destroy() + inReplyToEventTimelineItem?.destroy() } override val name: String? @@ -272,13 +273,6 @@ class RustMatrixRoom( } } - override suspend fun exitReplyMode(): Result = withContext(roomDispatcher) { - runCatching { - inReplyToEventTimelineItem?.destroy() - inReplyToEventTimelineItem = null - } - } - override suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result = withContext(roomDispatcher) { runCatching { val inReplyTo = inReplyToEventTimelineItem ?: innerRoom.getEventTimelineItemByEventId(eventId.value) diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt index 7771548d01..e8abdb62df 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeMatrixRoom.kt @@ -212,10 +212,6 @@ class FakeMatrixRoom( return Result.success(Unit) } - override suspend fun exitReplyMode(): Result { - return Result.success(Unit) - } - override suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result { replyMessageParameter = body to htmlBody return Result.success(Unit)