Add redaction menu (disabled).

This commit is contained in:
Doug
2022-09-14 09:40:00 +01:00
parent 4660f096f8
commit bd4a698f8b
12 changed files with 78 additions and 10 deletions
@@ -57,4 +57,8 @@ struct MockRoomProxy: RoomProxyProtocol {
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError> {
.failure(.failedSendingMessage)
}
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError> {
.failure(.failedRedactingEvent)
}
}
@@ -194,6 +194,22 @@ class RoomProxy: RoomProxyProtocol {
.value
}
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError> {
return .failure(.failedRedactingEvent)
#warning("Redactions to be enabled on next SDK release.")
// let transactionID = genTransactionId()
//
// return await Task {
// do {
// try room.redact(eventId: itemId, reason: nil, txnId: transactionID)
// return .success(())
// } catch {
// return .failure(.failedRedactingEvent)
// }
// }
// .value
}
// MARK: - Private
fileprivate func appendMessage(_ message: AnyMessage) {
@@ -24,6 +24,7 @@ enum RoomProxyError: Error {
case failedRetrievingMemberAvatarURL
case failedRetrievingMemberDisplayName
case failedSendingMessage
case failedRedactingEvent
}
enum RoomProxyCallback {
@@ -56,5 +57,7 @@ protocol RoomProxyProtocol {
func sendMessage(_ message: String) async -> Result<Void, RoomProxyError>
func redactItem(_ itemId: String) async -> Result<Void, RoomProxyError>
var callbacks: PassthroughSubject<RoomProxyCallback, Never> { get }
}