Implements #745, #746, #747 - Initial media uploading flows

- room composer contextual menu for selecting source
- coordinator for presenting the different sources
- system picker handling and URL passback
- file preview after selection
- feature flag
This commit is contained in:
Stefan Ceriu
2023-03-28 17:47:34 +03:00
committed by Stefan Ceriu
parent 2359910857
commit 5f6edacc1a
27 changed files with 787 additions and 29 deletions
+11 -7
View File
@@ -189,15 +189,15 @@ class RoomProxy: RoomProxyProtocol {
let transactionId = genTransactionId()
return await Task.dispatch(on: userInitiatedDispatchQueue) {
if let eventID {
do {
do {
if let eventID {
try self.room.sendReply(msg: message, inReplyToEventId: eventID, txnId: transactionId)
} catch {
return .failure(.failedSendingMessage)
} else {
let messageContent = messageEventContentFromMarkdown(md: message)
try self.room.send(msg: messageContent, txnId: transactionId)
}
} else {
let messageContent = messageEventContentFromMarkdown(md: message)
self.room.send(msg: messageContent, txnId: transactionId)
} catch {
return .failure(.failedSendingMessage)
}
return .success(())
}
@@ -218,6 +218,10 @@ class RoomProxy: RoomProxyProtocol {
}
}
}
func sendImage(body: String, url: URL) async -> Result<Void, RoomProxyError> {
.failure(.failedSendingMedia)
}
func editMessage(_ newMessage: String, original eventID: String) async -> Result<Void, RoomProxyError> {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
@@ -26,6 +26,7 @@ enum RoomProxyError: Error {
case failedSendingReadReceipt
case failedSendingMessage
case failedSendingReaction
case failedSendingMedia
case failedEditingMessage
case failedRedactingEvent
case failedReportingContent
@@ -69,6 +70,8 @@ protocol RoomProxyProtocol {
func sendMessage(_ message: String, inReplyTo eventID: String?) async -> Result<Void, RoomProxyError>
func sendReaction(_ reaction: String, to eventID: String) async -> Result<Void, RoomProxyError>
func sendImage(body: String, url: URL) async -> Result<Void, RoomProxyError>
func editMessage(_ newMessage: String, original eventID: String) async -> Result<Void, RoomProxyError>