mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +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:
@@ -61,11 +61,18 @@ class ThreadTimelineScreenViewModel: ThreadTimelineScreenViewModelType, ThreadTi
|
||||
|
||||
func displayMediaPreview(_ mediaPreviewViewModel: TimelineMediaPreviewViewModel) {
|
||||
mediaPreviewViewModel.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
case .viewInRoomTimeline:
|
||||
fatalError("viewInRoomTimeline should not be visible on a thread preview.")
|
||||
fatalError("\(action) should not be visible on a thread preview.")
|
||||
case .displayMessageForwarding(let forwardingItem):
|
||||
state.bindings.mediaPreviewViewModel = nil
|
||||
// We need a small delay because we need to wait for the media preview to be fully dismissed.
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + TimelineMediaPreviewViewModel.displayMessageForwardingDelay) {
|
||||
self.actionsSubject.send(.displayMessageForwarding(forwardingItem))
|
||||
}
|
||||
case .dismiss:
|
||||
self?.state.bindings.mediaPreviewViewModel = nil
|
||||
state.bindings.mediaPreviewViewModel = nil
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
Reference in New Issue
Block a user