mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-10-31 16:24:11 +00:00
Fix #5636 - Clear the composer after editing a message or caption
This commit is contained in:
+1
-1
@@ -79,7 +79,7 @@ class RoomPollsHistoryScreenViewModel: RoomPollsHistoryScreenViewModelType, Room
|
||||
if self.state.canBackPaginate != canBackPaginate {
|
||||
self.state.canBackPaginate = canBackPaginate
|
||||
}
|
||||
case .isLive, .sentMessage:
|
||||
case .isLive, .messageSentOrEdited:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
|
||||
state.timelineState.focussedEvent = nil
|
||||
}
|
||||
}
|
||||
case .sentMessage:
|
||||
case .messageSentOrEdited:
|
||||
actionsSubject.send(.composer(action: .clear))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +171,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
switch await activeTimeline.edit(eventOrTransactionID, newContent: .roomMessage(content: messageContent)) {
|
||||
case .success:
|
||||
MXLog.info("Finished editing message by event")
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
case let .failure(error):
|
||||
MXLog.error("Failed editing message by event with error: \(error)")
|
||||
}
|
||||
@@ -188,6 +189,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
mentions: intentionalMentions.toRustMentions())
|
||||
switch await activeTimeline.edit(eventOrTransactionID, newContent: newContent) {
|
||||
case .success:
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
MXLog.info("Finished editing caption")
|
||||
case let .failure(error):
|
||||
MXLog.error("Failed editing caption with error: \(error)")
|
||||
@@ -296,7 +298,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
intentionalMentions: intentionalMentions) {
|
||||
case .success:
|
||||
MXLog.info("Finished sending message")
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
await donateSendMessageIntent()
|
||||
case .failure(let error):
|
||||
MXLog.error("Failed sending message with error: \(error)")
|
||||
@@ -312,7 +314,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
caption: caption,
|
||||
requestHandle: requestHandle).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
@@ -328,7 +330,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
caption: caption,
|
||||
requestHandle: requestHandle).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
@@ -346,7 +348,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
caption: caption,
|
||||
requestHandle: requestHandle).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
@@ -364,7 +366,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
caption: caption,
|
||||
requestHandle: requestHandle).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
@@ -378,7 +380,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
assetType: AssetType?) async -> Result<Void, TimelineControllerError> {
|
||||
switch await activeTimeline.sendLocation(body: body, geoURI: geoURI, description: description, zoomLevel: zoomLevel, assetType: assetType).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
@@ -393,7 +395,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
audioInfo: audioInfo,
|
||||
waveform: waveform, requestHandle: requestHandle).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
@@ -405,7 +407,7 @@ class TimelineController: TimelineControllerProtocol {
|
||||
func createPoll(question: String, answers: [String], pollKind: Poll.Kind) async -> Result<Void, TimelineControllerError> {
|
||||
switch await activeTimeline.createPoll(question: question, answers: answers, pollKind: pollKind).mapError(TimelineControllerError.timelineProxyError) {
|
||||
case .success:
|
||||
callbacks.send(.sentMessage)
|
||||
callbacks.send(.messageSentOrEdited)
|
||||
return .success(())
|
||||
case .failure(let error):
|
||||
return .failure(error)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ enum TimelineControllerCallback {
|
||||
case updatedTimelineItems(timelineItems: [RoomTimelineItemProtocol], isSwitchingTimelines: Bool)
|
||||
case paginationState(TimelinePaginationState)
|
||||
case isLive(Bool)
|
||||
case sentMessage
|
||||
case messageSentOrEdited
|
||||
}
|
||||
|
||||
enum TimelineControllerAction {
|
||||
|
||||
Reference in New Issue
Block a user