Update dependency org.matrix.rustcomponents:sdk-android to v0.1.62 (#1562)

* Update dependency org.matrix.rustcomponents:sdk-android to v0.1.62
* Add `sendVoiceMessage()` API from https://github.com/matrix-org/matrix-rust-sdk/pull/2697
* Fix other breaking changes

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marco Romano <marcor@element.io>
This commit is contained in:
renovate[bot]
2023-10-13 08:19:30 +00:00
committed by GitHub
parent 1a8c29b979
commit 31d5e7395f
5 changed files with 32 additions and 7 deletions

View File

@@ -143,7 +143,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.61"
matrix_sdk = "org.matrix.rustcomponents:sdk-android:0.1.62"
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" }

View File

@@ -185,5 +185,12 @@ interface MatrixRoom : Closeable {
*/
suspend fun endPoll(pollStartId: EventId, text: String): Result<Unit>
suspend fun sendVoiceMessage(
file: File,
audioInfo: AudioInfo,
waveform: List<Int>,
progressCallback: ProgressCallback?
): Result<MediaUploadHandler>
override fun close() = destroy()
}

View File

@@ -298,10 +298,9 @@ class RustMatrixClient constructor(
runCatching { client.setDisplayName(displayName) }
}
@OptIn(ExperimentalUnsignedTypes::class)
override suspend fun uploadAvatar(mimeType: String, data: ByteArray): Result<Unit> =
withContext(sessionDispatcher) {
runCatching { client.uploadAvatar(mimeType, data.toUByteArray().toList()) }
runCatching { client.uploadAvatar(mimeType, data) }
}
override suspend fun removeAvatar(): Result<Unit> =
@@ -382,10 +381,9 @@ class RustMatrixClient constructor(
}
}
@OptIn(ExperimentalUnsignedTypes::class)
override suspend fun uploadMedia(mimeType: String, data: ByteArray, progressCallback: ProgressCallback?): Result<String> = withContext(sessionDispatcher) {
runCatching {
client.uploadMedia(mimeType, data.toUByteArray().toList(), progressCallback?.toProgressWatcher())
client.uploadMedia(mimeType, data, progressCallback?.toProgressWatcher())
}
}

View File

@@ -373,10 +373,9 @@ class RustMatrixRoom(
}
}
@OptIn(ExperimentalUnsignedTypes::class)
override suspend fun updateAvatar(mimeType: String, data: ByteArray): Result<Unit> = withContext(roomDispatcher) {
runCatching {
innerRoom.uploadAvatar(mimeType, data.toUByteArray().toList(), null)
innerRoom.uploadAvatar(mimeType, data, null)
}
}
@@ -465,6 +464,20 @@ class RustMatrixRoom(
}
}
override suspend fun sendVoiceMessage(
file: File,
audioInfo: AudioInfo,
waveform: List<Int>,
progressCallback: ProgressCallback?,
): Result<MediaUploadHandler> = sendAttachment(listOf(file)) {
innerRoom.sendVoiceMessage(
url = file.path,
audioInfo = audioInfo.map(),
waveform = waveform.map { it.toUShort() },
progressWatcher = progressCallback?.toProgressWatcher(),
)
}
private suspend fun sendAttachment(files: List<File>, handle: () -> SendAttachmentJoinHandle): Result<MediaUploadHandler> {
return runCatching {
MediaUploadHandlerImpl(files, handle())

View File

@@ -361,6 +361,13 @@ class FakeMatrixRoom(
return endPollResult
}
override suspend fun sendVoiceMessage(
file: File,
audioInfo: AudioInfo,
waveform: List<Int>,
progressCallback: ProgressCallback?
): Result<MediaUploadHandler> = fakeSendMedia(progressCallback)
fun givenLeaveRoomError(throwable: Throwable?) {
this.leaveRoomError = throwable
}