Redact event from the bottom sheet

This commit is contained in:
Benoit Marty 2022-11-22 16:37:17 +01:00
parent a5682398a6
commit 11a3babc5f
7 changed files with 55 additions and 6 deletions

View file

@ -2,7 +2,6 @@ package io.element.android.x.matrix.room
import io.element.android.x.core.coroutine.CoroutineDispatchers
import io.element.android.x.matrix.core.RoomId
import io.element.android.x.matrix.core.UserId
import io.element.android.x.matrix.timeline.MatrixTimeline
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
@ -76,4 +75,11 @@ class MatrixRoom(
room.send(content, transactionId)
}
}
suspend fun redactEvent(eventId: String, reason: String? = null, ) = withContext(coroutineDispatchers.io) {
val transactionId = genTransactionId()
runCatching {
room.redact(eventId, reason, transactionId)
}
}
}