Merge pull request #2653 from element-hq/feature/bma/copyPermalink

Copy permalink
This commit is contained in:
Benoit Marty
2024-04-03 17:38:38 +02:00
committed by GitHub
28 changed files with 122 additions and 36 deletions

View File

@@ -16,6 +16,7 @@
package io.element.android.libraries.matrix.impl.room
import io.element.android.appconfig.MatrixConfiguration
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
import io.element.android.libraries.core.coroutine.childScope
import io.element.android.libraries.matrix.api.core.EventId
@@ -711,6 +712,19 @@ class RustMatrixRoom(
)
}
override suspend fun getPermalinkFor(eventId: EventId): Result<String> {
// FIXME Use the SDK API once https://github.com/matrix-org/matrix-rust-sdk/issues/3259 has been done
// Now use a simple builder
return runCatching {
buildString {
append(MatrixConfiguration.MATRIX_TO_PERMALINK_BASE_URL)
append(roomId.value)
append("/")
append(eventId.value)
}
}
}
private fun sendAttachment(files: List<File>, handle: () -> SendAttachmentJoinHandle): Result<MediaUploadHandler> {
return runCatching {
MediaUploadHandlerImpl(files, handle())