mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Implemented message forwarding for media previews and media timelines (#4579)
* implemented message forwarding for media previews and media timelines * updated tests * pr suggestion * fix tests * fix tests
This commit is contained in:
@@ -10,6 +10,7 @@ import Foundation
|
||||
|
||||
enum MediaEventsTimelineFlowCoordinatorAction {
|
||||
case viewInRoomTimeline(TimelineItemIdentifier)
|
||||
case displayMessageForwarding(MessageForwardingItem)
|
||||
case finished
|
||||
}
|
||||
|
||||
@@ -91,10 +92,13 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
coordinator.actions
|
||||
.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .displayMessageForwarding(let forwardingItem):
|
||||
actionsSubject.send(.displayMessageForwarding(forwardingItem))
|
||||
case .viewInRoomTimeline(let itemID):
|
||||
self?.navigationStackCoordinator.pop(animated: false)
|
||||
self?.actionsSubject.send(.viewInRoomTimeline(itemID))
|
||||
navigationStackCoordinator.pop(animated: false)
|
||||
actionsSubject.send(.viewInRoomTimeline(itemID))
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -1592,12 +1592,15 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
case .viewInRoomTimeline(let itemID):
|
||||
guard let eventID = itemID.eventID else {
|
||||
MXLog.error("Unable to present room timeline for event \(itemID)")
|
||||
|
||||
return
|
||||
}
|
||||
stateMachine.tryEvent(.presentRoom(presentationAction: .eventFocus(.init(eventID: eventID, shouldSetPin: false))),
|
||||
userInfo: EventUserInfo(animated: false)) // No animation so the timeline visible when the preview animates away.
|
||||
case .finished:
|
||||
stateMachine.tryEvent(.dismissMediaEventsTimeline)
|
||||
case .displayMessageForwarding(let forwardingItem):
|
||||
stateMachine.tryEvent(.presentMessageForwarding(forwardingItem: forwardingItem))
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -198,6 +198,8 @@ extension RoomFlowCoordinator {
|
||||
|
||||
case (.room, .presentMessageForwarding(let forwardingItem)):
|
||||
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
|
||||
case (.mediaEventsTimeline, .presentMessageForwarding(forwardingItem: let forwardingItem)):
|
||||
return .messageForwarding(forwardingItem: forwardingItem, previousState: fromState)
|
||||
|
||||
case (.room, .presentMapNavigator(_)):
|
||||
return .mapNavigator(previousState: fromState)
|
||||
|
||||
Reference in New Issue
Block a user