Skip to content

Commit cf657df

Browse files
committed
Fix API break with Matrix SDK 0.1.58.
1 parent 3c692e4 commit cf657df

File tree

4 files changed

+10
-14
lines changed

4 files changed

+10
-14
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ sealed interface NotificationContent {
6161
) : MessageLike
6262
data object RoomRedaction : MessageLike
6363
data object Sticker : MessageLike
64+
data class Poll(val question: String) : MessageLike
6465
}
6566

6667
sealed interface StateEvent : NotificationContent {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ private fun MessageLikeEventContent.toContent(senderId: UserId): NotificationCon
9494
}
9595
MessageLikeEventContent.RoomRedaction -> NotificationContent.MessageLike.RoomRedaction
9696
MessageLikeEventContent.Sticker -> NotificationContent.MessageLike.Sticker
97+
is MessageLikeEventContent.Poll -> NotificationContent.MessageLike.Poll(question)
9798
}
9899
}
99100
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import org.matrix.rustcomponents.sdk.Room
2727
import org.matrix.rustcomponents.sdk.RoomListService
2828
import org.matrix.rustcomponents.sdk.TimelineDiff
2929
import org.matrix.rustcomponents.sdk.TimelineListener
30-
import org.matrix.rustcomponents.sdk.genTransactionId
3130
import kotlin.time.Duration.Companion.milliseconds
3231

3332
/**
@@ -61,7 +60,7 @@ class RoomContentForwarder(
6160
// Sending a message requires a registered timeline listener
6261
targetRoom.addTimelineListener(NoOpTimelineListener)
6362
withTimeout(timeoutMs.milliseconds) {
64-
targetRoom.send(content, genTransactionId())
63+
targetRoom.send(content)
6564
}
6665
}
6766
// After sending, we remove the timeline

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

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ import org.matrix.rustcomponents.sdk.RoomMember
6767
import org.matrix.rustcomponents.sdk.RoomMessageEventContentWithoutRelation
6868
import org.matrix.rustcomponents.sdk.RoomSubscription
6969
import org.matrix.rustcomponents.sdk.SendAttachmentJoinHandle
70-
import org.matrix.rustcomponents.sdk.genTransactionId
7170
import org.matrix.rustcomponents.sdk.messageEventContentFromHtml
7271
import org.matrix.rustcomponents.sdk.messageEventContentFromMarkdown
7372
import timber.log.Timber
@@ -241,10 +240,9 @@ class RustMatrixRoom(
241240
}
242241

243242
override suspend fun sendMessage(body: String, htmlBody: String?): Result<Unit> = withContext(roomDispatcher) {
244-
val transactionId = genTransactionId()
245243
messageEventContentFromParts(body, htmlBody).use { content ->
246244
runCatching {
247-
innerRoom.send(content, transactionId)
245+
innerRoom.send(content)
248246
}
249247
}
250248
}
@@ -253,26 +251,27 @@ class RustMatrixRoom(
253251
withContext(roomDispatcher) {
254252
if (originalEventId != null) {
255253
runCatching {
256-
innerRoom.edit(messageEventContentFromParts(body, htmlBody), originalEventId.value, transactionId?.value)
254+
innerRoom.edit(messageEventContentFromParts(body, htmlBody), originalEventId.value)
257255
}
258256
} else {
259257
runCatching {
260258
transactionId?.let { cancelSend(it) }
261-
innerRoom.send(messageEventContentFromParts(body, htmlBody), genTransactionId())
259+
innerRoom.send(messageEventContentFromParts(body, htmlBody))
262260
}
263261
}
264262
}
265263

266264
override suspend fun replyMessage(eventId: EventId, body: String, htmlBody: String?): Result<Unit> = withContext(roomDispatcher) {
267265
runCatching {
268-
innerRoom.sendReply(messageEventContentFromParts(body, htmlBody), eventId.value, genTransactionId())
266+
innerRoom.getEventTimelineItemByEventId(eventId.value).use { eventTimelineItem ->
267+
innerRoom.sendReply(messageEventContentFromParts(body, htmlBody), eventTimelineItem)
268+
}
269269
}
270270
}
271271

272272
override suspend fun redactEvent(eventId: EventId, reason: String?) = withContext(roomDispatcher) {
273-
val transactionId = genTransactionId()
274273
runCatching {
275-
innerRoom.redact(eventId.value, reason, transactionId)
274+
innerRoom.redact(eventId.value, reason)
276275
}
277276
}
278277

@@ -416,7 +415,6 @@ class RustMatrixRoom(
416415
description = description,
417416
zoomLevel = zoomLevel?.toUByte(),
418417
assetType = assetType?.toInner(),
419-
txnId = genTransactionId(),
420418
)
421419
}
422420
}
@@ -433,7 +431,6 @@ class RustMatrixRoom(
433431
answers = answers,
434432
maxSelections = maxSelections.toUByte(),
435433
pollKind = pollKind.toInner(),
436-
txnId = genTransactionId(),
437434
)
438435
}
439436
}
@@ -446,7 +443,6 @@ class RustMatrixRoom(
446443
innerRoom.sendPollResponse(
447444
pollStartId = pollStartId.value,
448445
answers = answers,
449-
txnId = genTransactionId(),
450446
)
451447
}
452448
}
@@ -459,7 +455,6 @@ class RustMatrixRoom(
459455
innerRoom.endPoll(
460456
pollStartId = pollStartId.value,
461457
text = text,
462-
txnId = genTransactionId(),
463458
)
464459
}
465460
}

0 commit comments

Comments
 (0)