Non-decryptable timeline items and debug menu (#300)

* Fixes #292 - Added a timeline item context menu option for printing and showing their debug description
* Fixes #291 - Add support for non-decryptable timeline items
This commit is contained in:
Stefan Ceriu
2022-11-08 13:17:38 +02:00
committed by GitHub
parent 7a7680b165
commit 89742ceb53
17 changed files with 312 additions and 21 deletions
@@ -161,10 +161,10 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
}
}
private func contextMenuActionsForItemId(_ itemId: String) -> [TimelineItemContextMenuAction] {
private func contextMenuActionsForItemId(_ itemId: String) -> TimelineItemContextMenuActions {
guard let timelineItem = timelineController.timelineItems.first(where: { $0.id == itemId }),
timelineItem is EventBasedTimelineItemProtocol else {
return []
return .init(actions: [])
}
var actions: [TimelineItemContextMenuAction] = [
@@ -175,7 +175,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
actions.append(.redact)
}
return actions
return .init(actions: actions)
}
private func processContentMenuAction(_ action: TimelineItemContextMenuAction, itemId: String) {
@@ -202,6 +202,10 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
case .reply:
state.bindings.composerFocused = true
state.composerMode = .reply(id: item.id, displayName: item.senderDisplayName ?? item.senderId)
case .viewSource:
let debugDescription = timelineController.debugDescriptionFor(item.id)
MXLog.info(debugDescription)
state.bindings.debugInfo = .init(title: "Timeline item", content: debugDescription)
}
switch action {