mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:31:27 +00:00
Fixes vector-im/element-x-ios/issues/114 - Replying to timeline items
This commit is contained in:
@@ -66,5 +66,7 @@ class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async { }
|
||||
|
||||
func sendReply(_ message: String, to itemId: String) async { }
|
||||
|
||||
func redact(_ eventID: String) async { }
|
||||
}
|
||||
|
||||
@@ -104,13 +104,20 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func sendReply(_ message: String, to itemId: String) async {
|
||||
switch await timelineProvider.sendMessage(message, inReplyToItemId: itemId) {
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
func redact(_ eventID: String) async {
|
||||
switch await timelineProvider.redact(eventID) {
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@objc private func contentSizeCategoryDidChange() {
|
||||
|
||||
@@ -41,5 +41,7 @@ protocol RoomTimelineControllerProtocol {
|
||||
|
||||
func sendMessage(_ message: String) async
|
||||
|
||||
func sendReply(_ message: String, to itemId: String) async
|
||||
|
||||
func redact(_ eventID: String) async
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
switch await roomProxy.sendMessage(message) {
|
||||
func sendMessage(_ message: String, inReplyToItemId: String?) async -> Result<Void, RoomTimelineProviderError> {
|
||||
switch await roomProxy.sendMessage(message, inReplyToEventId: inReplyToItemId) {
|
||||
case .success:
|
||||
return .success(())
|
||||
case .failure:
|
||||
|
||||
@@ -35,7 +35,13 @@ protocol RoomTimelineProviderProtocol {
|
||||
|
||||
func paginateBackwards(_ count: UInt) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
func sendMessage(_ message: String, inReplyToItemId: String?) async -> Result<Void, RoomTimelineProviderError>
|
||||
|
||||
func redact(_ eventID: String) async -> Result<Void, RoomTimelineProviderError>
|
||||
}
|
||||
|
||||
extension RoomTimelineProviderProtocol {
|
||||
func sendMessage(_ message: String) async -> Result<Void, RoomTimelineProviderError> {
|
||||
await sendMessage(message, inReplyToItemId: nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user