mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-10 01:01:36 +00:00
Rework the presentation of the media browser quick look view to use SwiftUI. (#3619)
* Embed the media preview quick look inside a full screen cover With a zoom transition on iOS 18. * Use a the representable coordinator properly. * Fix a bug with the toolbar appearance. * Format * Try prevent the zoom transition being upside down. * Fix the snapshot test configuration.
This commit is contained in:
@@ -95,8 +95,8 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
coordinator.actions
|
||||
.sink { [weak self] action in
|
||||
switch action {
|
||||
case .viewInRoomTimeline(let itemID):
|
||||
self?.actionsSubject.send(.viewInRoomTimeline(itemID))
|
||||
case .viewItem(let previewContext):
|
||||
self?.presentMediaPreview(for: previewContext)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
@@ -105,4 +105,28 @@ class MediaEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
||||
self?.actionsSubject.send(.finished)
|
||||
}
|
||||
}
|
||||
|
||||
private func presentMediaPreview(for previewContext: TimelineMediaPreviewContext) {
|
||||
let parameters = TimelineMediaPreviewCoordinatorParameters(context: previewContext,
|
||||
mediaProvider: userSession.mediaProvider,
|
||||
userIndicatorController: userIndicatorController)
|
||||
|
||||
let coordinator = TimelineMediaPreviewCoordinator(parameters: parameters)
|
||||
coordinator.actionsPublisher
|
||||
.sink { [weak self] action in
|
||||
switch action {
|
||||
case .viewInRoomTimeline(let itemID):
|
||||
self?.navigationStackCoordinator.pop(animated: false)
|
||||
self?.actionsSubject.send(.viewInRoomTimeline(itemID))
|
||||
self?.navigationStackCoordinator.setFullScreenCoverCoordinator(nil)
|
||||
case .dismiss:
|
||||
self?.navigationStackCoordinator.setFullScreenCoverCoordinator(nil)
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
navigationStackCoordinator.setFullScreenCoverCoordinator(coordinator) {
|
||||
previewContext.completion?()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1583,8 +1583,8 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
MXLog.error("Unable to present room timeline for event \(itemID)")
|
||||
return
|
||||
}
|
||||
stateMachine.tryEvent(.dismissMediaEventsTimeline)
|
||||
stateMachine.tryEvent(.presentRoom(presentationAction: .eventFocus(.init(eventID: eventID, shouldSetPin: false))))
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user