mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Hook up the actions in the media details sheet. (#3607)
This commit is contained in:
@@ -55,9 +55,9 @@ class TimelineMediaPreviewController: QLPreviewController, QLPreviewControllerDa
|
||||
switch action {
|
||||
case .loadedMediaFile:
|
||||
self?.refreshCurrentPreviewItem()
|
||||
case .viewInTimeline:
|
||||
case .viewInRoomTimeline, .dismiss:
|
||||
self?.dismiss(animated: true) // Dismiss the details sheet.
|
||||
// Errrr, hmmmmm, do something else here.
|
||||
// And let the view model handle the rest.
|
||||
}
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
|
||||
import QuickLook
|
||||
|
||||
enum TimelineMediaPreviewViewModelAction {
|
||||
enum TimelineMediaPreviewViewModelAction: Equatable {
|
||||
case loadedMediaFile
|
||||
case viewInTimeline
|
||||
case viewInRoomTimeline(TimelineItemIdentifier)
|
||||
case dismiss
|
||||
}
|
||||
|
||||
struct TimelineMediaPreviewViewState: BindableState {
|
||||
|
||||
@@ -51,14 +51,16 @@ class TimelineMediaPreviewViewModel: TimelineMediaPreviewViewModelType {
|
||||
case .menuAction(let action):
|
||||
switch action {
|
||||
case .viewInRoomTimeline:
|
||||
actionsSubject.send(.viewInTimeline)
|
||||
actionsSubject.send(.viewInRoomTimeline(state.currentItem.id))
|
||||
case .redact:
|
||||
state.bindings.isPresentingRedactConfirmation = true
|
||||
default:
|
||||
MXLog.error("Received unexpected action: \(action)")
|
||||
}
|
||||
case .redactConfirmation:
|
||||
break // Do it here??
|
||||
timelineViewModel.context.send(viewAction: .handleTimelineItemMenuAction(itemID: state.currentItem.id, action: .redact))
|
||||
state.bindings.isPresentingRedactConfirmation = false
|
||||
actionsSubject.send(.dismiss) // Will dismiss the details sheet and the QuickLook view.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user