diff --git a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt index 32a6f2e409..6a307f6e62 100644 --- a/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt +++ b/libraries/matrix/api/src/main/kotlin/io/element/android/libraries/matrix/api/room/JoinedRoom.kt @@ -212,4 +212,16 @@ interface JoinedRoom : BaseRoom { * @return Result indicating success or failure. */ suspend fun sendLiveLocation(geoUri: String): Result + + /** + * 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 } diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt index e6287d0d16..ca25eef6ea 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/JoinedRustRoom.kt @@ -532,6 +532,13 @@ class JoinedRustRoom( } } + override suspend fun sendRawEvent(eventType: String, content: String): Result = withContext(roomDispatcher) { + runCatchingExceptions { + innerRoom.sendRaw(eventType, content) + Unit + } + } + override fun close() = destroy() override fun destroy() { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt index e5cc9450a9..cce3df3de5 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/timeline/RustTimeline.kt @@ -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 = withContext(dispatcher) { - runCatchingExceptions { - inner.sendRaw(eventType, content) - Unit - } - } + ): Result = joinedRoom.sendRawEvent(eventType, content) override suspend fun redactEvent(eventOrTransactionId: EventOrTransactionId, reason: String?): Result = withContext(dispatcher) { runCatchingExceptions { diff --git a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt index d1c2b81612..dc3f8c305b 100644 --- a/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt +++ b/libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/tracing/RustTracingService.kt @@ -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, ) } diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt index 84497b38de..acdad8225d 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/room/FakeJoinedRoom.kt @@ -250,6 +250,11 @@ class FakeJoinedRoom( sendLiveLocationResult(geoUri) } + var sendRawEventResult: (String, String) -> Result = { _, _ -> Result.success(Unit) } + override suspend fun sendRawEvent(eventType: String, content: String): Result = simulateLongTask { + sendRawEventResult(eventType, content) + } + private suspend fun simulateSendMediaProgress(progressCallback: ProgressCallback?) { progressCallbackValues.forEach { (current, total) -> progressCallback?.onProgress(current, total)