Retry send and cancel send for failed to send messages (#1088)

* is now possible to open the confirmation dialog and pass the transaction id

* task completed added some tests

* changelog

* title visibility set to .visible
This commit is contained in:
Mauro
2023-06-16 11:00:54 +02:00
committed by GitHub
parent 163e38b1a9
commit ac41704821
17 changed files with 281 additions and 23 deletions
@@ -326,6 +326,28 @@ class RoomProxy: RoomProxyProtocol {
}
}
func retrySend(transactionID: String) async {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
sendMessageBackgroundTask?.stop()
}
return await Task.dispatch(on: userInitiatedDispatchQueue) {
self.room.retrySend(txnId: transactionID)
}
}
func cancelSend(transactionID: String) async {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
sendMessageBackgroundTask?.stop()
}
return await Task.dispatch(on: userInitiatedDispatchQueue) {
self.room.cancelSend(txnId: transactionID)
}
}
func editMessage(_ newMessage: String, original eventID: String) async -> Result<Void, RoomProxyError> {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
@@ -101,6 +101,12 @@ protocol RoomProxyProtocol {
func sendFile(url: URL, fileInfo: FileInfo) async -> Result<Void, RoomProxyError>
/// Retries sending a failed message given its transaction ID
func retrySend(transactionID: String) async
/// Cancels a failed message given its transaction ID from the timeline
func cancelSend(transactionID: String) async
func editMessage(_ newMessage: String, original eventID: String) async -> Result<Void, RoomProxyError>
func redact(_ eventID: String) async -> Result<Void, RoomProxyError>