mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
Send reaction method placeholder (#355)
* Send reaction method placeholder * Removed unnecessary emoji skin parsing * Code review fixes
This commit is contained in:
committed by
GitHub
parent
7db7eec98f
commit
1e197d48de
@@ -115,6 +115,8 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
func sendMessage(_ message: String) async { }
|
||||
|
||||
func sendReply(_ message: String, to itemId: String) async { }
|
||||
|
||||
func sendReaction(_ reaction: String, for itemId: String) async { }
|
||||
|
||||
func editMessage(_ newMessage: String, of itemId: String) async { }
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ struct MockRoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
.failure(.failedSendingMessage)
|
||||
}
|
||||
|
||||
func sendReaction(_ reaction: String, for itemId: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
.failure(.failedSendingReaction)
|
||||
}
|
||||
|
||||
func editMessage(_ newMessage: String, originalItemId: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
.failure(.failedSendingMessage)
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
|
||||
func processItemDisappearance(_ itemId: String) { }
|
||||
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func processItemTap(_ itemId: String) async -> RoomTimelineControllerAction {
|
||||
guard let timelineItem = timelineItems.first(where: { $0.id == itemId }) else {
|
||||
return .none
|
||||
@@ -162,6 +163,13 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func sendReaction(_ reaction: String, for itemId: String) async {
|
||||
switch await timelineProvider.sendReaction(reaction, for: itemId) {
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func editMessage(_ newMessage: String, of itemId: String) async {
|
||||
switch await timelineProvider.editMessage(newMessage, originalItemId: itemId) {
|
||||
|
||||
@@ -55,6 +55,8 @@ protocol RoomTimelineControllerProtocol {
|
||||
func sendReply(_ message: String, to itemId: String) async
|
||||
|
||||
func editMessage(_ newMessage: String, of itemId: String) async
|
||||
|
||||
func sendReaction(_ reaction: String, for itemId: String) async
|
||||
|
||||
func redact(_ eventID: String) async
|
||||
|
||||
|
||||
@@ -103,6 +103,17 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
return .failure(.failedSendingMessage)
|
||||
}
|
||||
}
|
||||
|
||||
func sendReaction(_ reaction: String, for itemId: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
switch await roomProxy.sendReaction(reaction, for: itemId) {
|
||||
case .success:
|
||||
MXLog.info("Finished sending reaction")
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
MXLog.error("Failed sending reaction with error: \(error)")
|
||||
return .failure(.failedSendingReaction)
|
||||
}
|
||||
}
|
||||
|
||||
func editMessage(_ newMessage: String, originalItemId: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
MXLog.info("Editing message: \(originalItemId)")
|
||||
|
||||
@@ -21,6 +21,7 @@ enum RoomTimelineProviderError: Error {
|
||||
case noMoreMessagesToBackPaginate
|
||||
case failedPaginatingBackwards
|
||||
case failedSendingMessage
|
||||
case failedSendingReaction
|
||||
case failedRedactingItem
|
||||
case generic
|
||||
}
|
||||
@@ -34,6 +35,8 @@ protocol RoomTimelineProviderProtocol {
|
||||
|
||||
func sendMessage(_ message: String, inReplyToItemId: String?) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func sendReaction(_ reaction: String, for itemId: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func editMessage(_ newMessage: String, originalItemId: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func redact(_ eventID: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
Reference in New Issue
Block a user