Browse Source

Merge pull request #3446 from element-hq/feature/bma/sdkUpgrade

Rust sdk upgrade to 0.2.43
pull/3449/head
Benoit Marty 1 month ago committed by GitHub
parent
commit
2428273d20
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      gradle/libs.versions.toml
  2. 1
      libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt
  3. 24
      libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt

2
gradle/libs.versions.toml

@ -162,7 +162,7 @@ jsoup = "org.jsoup:jsoup:1.18.1" @@ -162,7 +162,7 @@ jsoup = "org.jsoup:jsoup:1.18.1"
appyx_core = { module = "com.bumble.appyx:core", version.ref = "appyx" }
molecule-runtime = "app.cash.molecule:molecule-runtime:2.0.0"
timber = "com.jakewharton.timber:timber:5.0.1"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.42"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.2.43"
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" }

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

@ -188,6 +188,7 @@ class RustMatrixRoom( @@ -188,6 +188,7 @@ class RustMatrixRoom(
innerRoom.pinnedEventsTimeline(
internalIdPrefix = "pinned_events",
maxEventsToLoad = 100u,
maxConcurrentRequests = 10u,
).let { inner ->
createTimeline(inner, mode = Timeline.Mode.PINNED_EVENTS)
}

24
libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt

@ -61,9 +61,11 @@ import kotlinx.coroutines.flow.onEach @@ -61,9 +61,11 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.matrix.rustcomponents.sdk.EditedContent
import org.matrix.rustcomponents.sdk.EventTimelineItem
import org.matrix.rustcomponents.sdk.FormattedBody
import org.matrix.rustcomponents.sdk.MessageFormat
import org.matrix.rustcomponents.sdk.PollData
import org.matrix.rustcomponents.sdk.SendAttachmentJoinHandle
import org.matrix.rustcomponents.sdk.use
import timber.log.Timber
@ -274,8 +276,15 @@ class RustTimeline( @@ -274,8 +276,15 @@ class RustTimeline(
withContext(dispatcher) {
runCatching<Unit> {
getEventTimelineItem(originalEventId, transactionId).use { item ->
val editedContent = EditedContent.RoomMessage(
content = MessageEventContent.from(
body = body,
htmlBody = htmlBody,
intentionalMentions = intentionalMentions
),
)
inner.edit(
newContent = MessageEventContent.from(body, htmlBody, intentionalMentions),
newContent = editedContent,
item = item,
)
}
@ -434,16 +443,21 @@ class RustTimeline( @@ -434,16 +443,21 @@ class RustTimeline(
inner.getEventTimelineItemByEventId(
eventId = pollStartId.value
)
pollStartEvent.use {
inner.editPoll(
val editedContent = EditedContent.PollStart(
pollData = PollData(
question = question,
answers = answers,
maxSelections = maxSelections.toUByte(),
pollKind = pollKind.toInner(),
editItem = pollStartEvent,
),
)
pollStartEvent.use {
inner.edit(
newContent = editedContent,
item = it,
)
}
}
}.map { }
}
override suspend fun sendPollResponse(

Loading…
Cancel
Save