fix(sdk): adapt to matrix-rust-sdk 26.04.x API shifts

TracingConfiguration gained a required sentryConfig parameter between
26.03.x and 26.04.x. Pass null — we don't use SDK-side Sentry.

Timeline.sendRaw was moved off Timeline onto Room. Add sendRawEvent to
the JoinedRoom API interface, implement in JoinedRustRoom by calling
innerRoom.sendRaw, and have RustTimeline.sendRaw proxy through the
owning JoinedRoom. Our /pay event path keeps working without callers
having to know about the SDK move.
This commit is contained in:
Cobb 2026-04-17 10:12:48 -07:00
parent 0ef6b69a79
commit a944499eda
5 changed files with 31 additions and 8 deletions

View file

@ -212,4 +212,16 @@ interface JoinedRoom : BaseRoom {
* @return Result indicating success or failure.
*/
suspend fun sendLiveLocation(geoUri: String): Result<Unit>
/**
* Send a custom/raw event to the room (non-message event types).
*
* Used by the Cardano wallet for `/pay` events
* (e.g., `co.sulkta.payment.request`). Upstream SDK moved raw event
* sending from Timeline to Room; this method proxies through.
*
* @param eventType The custom event type string
* @param content The JSON-serialized event content
*/
suspend fun sendRawEvent(eventType: String, content: String): Result<Unit>
}

View file

@ -532,6 +532,13 @@ class JoinedRustRoom(
}
}
override suspend fun sendRawEvent(eventType: String, content: String): Result<Unit> = withContext(roomDispatcher) {
runCatchingExceptions {
innerRoom.sendRaw(eventType, content)
Unit
}
}
override fun close() = destroy()
override fun destroy() {

View file

@ -295,19 +295,16 @@ class RustTimeline(
/**
* Send a raw/custom event to the room.
*
* The Rust SDK moved raw event sending from Timeline to Room between
* 26.03.x and 26.04.x, so we proxy through the owning JoinedRoom.
*
* @param eventType The event type (e.g., "co.sulkta.payment.request")
* @param content The JSON content of the event
* @return Result indicating success or failure
*/
override suspend fun sendRaw(
eventType: String,
content: String,
): Result<Unit> = withContext(dispatcher) {
runCatchingExceptions {
inner.sendRaw(eventType, content)
Unit
}
}
): Result<Unit> = joinedRoom.sendRawEvent(eventType, content)
override suspend fun redactEvent(eventOrTransactionId: EventOrTransactionId, reason: String?): Result<Unit> = withContext(dispatcher) {
runCatchingExceptions {

View file

@ -61,12 +61,14 @@ private fun WriteToFilesConfiguration.toTracingFileConfiguration(): TracingFileC
@Suppress("UNUSED_PARAMETER")
fun TracingConfiguration.map(buildMeta: BuildMeta): org.matrix.rustcomponents.sdk.TracingConfiguration {
// Note: sdkSentryDsn is no longer supported by the Rust SDK
// Note: sdkSentryDsn was removed; the SDK now takes an optional SentryConfig
// object which we don't use. Passing null opts out of SDK-side Sentry.
return org.matrix.rustcomponents.sdk.TracingConfiguration(
writeToStdoutOrSystem = writesToLogcat,
logLevel = logLevel.toRustLogLevel(),
extraTargets = extraTargets,
traceLogPacks = traceLogPacks.map(),
writeToFiles = writesToFilesConfiguration.toTracingFileConfiguration(),
sentryConfig = null,
)
}

View file

@ -250,6 +250,11 @@ class FakeJoinedRoom(
sendLiveLocationResult(geoUri)
}
var sendRawEventResult: (String, String) -> Result<Unit> = { _, _ -> Result.success(Unit) }
override suspend fun sendRawEvent(eventType: String, content: String): Result<Unit> = simulateLongTask {
sendRawEventResult(eventType, content)
}
private suspend fun simulateSendMediaProgress(progressCallback: ProgressCallback?) {
progressCallbackValues.forEach { (current, total) ->
progressCallback?.onProgress(current, total)