Rename sendReaction as toggleReaction

This commit is contained in:
aringenbach
2023-06-26 17:44:31 +02:00
committed by Stefan Ceriu
parent 7d3dcee5a3
commit 88ac3fb8c6
12 changed files with 32 additions and 32 deletions
@@ -260,7 +260,7 @@ class RoomProxy: RoomProxyProtocol {
}
}
func sendReaction(_ reaction: String, to eventID: String) async -> Result<Void, RoomProxyError> {
func toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, RoomProxyError> {
sendMessageBackgroundTask = backgroundTaskService.startBackgroundTask(withName: backgroundTaskName, isReusable: true)
defer {
sendMessageBackgroundTask?.stop()
@@ -268,7 +268,7 @@ class RoomProxy: RoomProxyProtocol {
return await Task.dispatch(on: userInitiatedDispatchQueue) {
do {
try self.room.sendReaction(eventId: eventID, key: reaction)
try self.room.toggleReaction(eventId: eventID, key: reaction)
return .success(())
} catch {
return .failure(.failedSendingReaction)
@@ -92,7 +92,7 @@ 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 toggleReaction(_ reaction: String, to eventID: String) async -> Result<Void, RoomProxyError>
func sendImage(url: URL, thumbnailURL: URL, imageInfo: ImageInfo, progressSubject: CurrentValueSubject<Double, Never>?) async -> Result<Void, RoomProxyError>
@@ -59,7 +59,7 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
func sendMessage(_ message: String, inReplyTo itemID: String?) async { }
func sendReaction(_ reaction: String, to itemID: String) async { }
func toggleReaction(_ reaction: String, to itemID: String) async { }
func editMessage(_ newMessage: String, original itemID: String) async { }
@@ -156,13 +156,13 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
}
}
func sendReaction(_ reaction: String, to itemID: String) async {
MXLog.info("Send reaction in \(roomID)")
switch await roomProxy.sendReaction(reaction, to: itemID) {
func toggleReaction(_ reaction: String, to itemID: String) async {
MXLog.info("Toggle reaction in \(roomID)")
switch await roomProxy.toggleReaction(reaction, to: itemID) {
case .success:
MXLog.info("Finished sending reaction")
MXLog.info("Finished toggling reaction")
case .failure(let error):
MXLog.error("Failed sending reaction with error: \(error)")
MXLog.error("Failed toggling reaction with error: \(error)")
}
}
@@ -54,7 +54,7 @@ protocol RoomTimelineControllerProtocol {
func editMessage(_ newMessage: String, original itemID: String) async
func sendReaction(_ reaction: String, to itemID: String) async
func toggleReaction(_ reaction: String, to itemID: String) async
func redact(_ itemID: String) async