mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Add mechanism for opening up a threaded timeline
This commit is contained in:
committed by
Stefan Ceriu
parent
2f938d3cbf
commit
10fb2b5dda
@@ -554,7 +554,7 @@ class TimelineInteractionHandler {
|
||||
case .pinned:
|
||||
newTimelineFocus = .pinned
|
||||
newTimelinePresentation = .pinnedEventsScreen
|
||||
case .media:
|
||||
case .media, .thread:
|
||||
break // We don't need to create a new timeline as it is already filtered.
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ enum TimelineViewModelAction {
|
||||
case displayMediaPreview(TimelineMediaPreviewViewModel)
|
||||
case displayLocation(body: String, geoURI: GeoURI, description: String?)
|
||||
case displayResolveSendFailure(failure: TimelineItemSendFailure.VerifiedUser, sendHandle: SendHandleProxy)
|
||||
case displayThread(itemID: TimelineItemIdentifier)
|
||||
case composer(action: TimelineComposerAction)
|
||||
case hasScrolled(direction: ScrollDirection)
|
||||
case viewInRoomTimeline(eventID: String)
|
||||
|
||||
@@ -191,8 +191,8 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
|
||||
displayReactionSummary(for: itemID, selectedKey: key)
|
||||
case .displayReadReceipts(let itemID):
|
||||
displayReadReceipts(for: itemID)
|
||||
case .displayThread:
|
||||
break
|
||||
case .displayThread(let itemID):
|
||||
actionsSubject.send(.displayThread(itemID: itemID))
|
||||
case .handlePasteOrDrop(let provider):
|
||||
timelineInteractionHandler.handlePasteOrDrop(provider)
|
||||
case .handlePollAction(let pollAction):
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ struct TimelineItemMenuActionProvider {
|
||||
actions.append(.save)
|
||||
actions = actions.filter(\.canAppearInMediaDetails)
|
||||
secondaryActions = secondaryActions.filter(\.canAppearInMediaDetails)
|
||||
case .live, .detached:
|
||||
case .live, .detached, .thread:
|
||||
break // viewInRoomTimeline is the only non-room item and was added conditionally.
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
.onTapGesture { }
|
||||
}
|
||||
|
||||
if let threadSummary = timelineItem.properties.threadSummary {
|
||||
if context.viewState.timelineKind != .thread, let threadSummary = timelineItem.properties.threadSummary {
|
||||
TimelineThreadSummaryView(threadSummary: threadSummary) {
|
||||
context.send(viewAction: .displayThread(itemID: timelineItem.id))
|
||||
}
|
||||
@@ -177,13 +177,13 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
@ViewBuilder
|
||||
var contentWithReply: some View {
|
||||
TimelineBubbleLayout(spacing: 8) {
|
||||
if timelineItem.properties.isThreaded {
|
||||
if context.viewState.timelineKind != .thread, timelineItem.properties.isThreaded {
|
||||
ThreadDecorator()
|
||||
.padding(.leading, 4)
|
||||
.layoutPriority(TimelineBubbleLayout.Priority.regularText)
|
||||
}
|
||||
|
||||
if let replyDetails = timelineItem.properties.replyDetails {
|
||||
if shouldShowReplyDetails, let replyDetails = timelineItem.properties.replyDetails {
|
||||
// The rendered reply bubble with a greedy width. The custom layout prevents
|
||||
// the infinite width from increasing the overall width of the view.
|
||||
|
||||
@@ -212,6 +212,10 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var shouldShowReplyDetails: Bool {
|
||||
!timelineItem.properties.isThreaded || (timelineItem.properties.isThreaded && context.viewState.timelineKind != .thread)
|
||||
}
|
||||
|
||||
private var messageBubbleTopPadding: CGFloat {
|
||||
guard timelineItem.isOutgoing || isDirectOneToOneRoom else { return 0 }
|
||||
return timelineGroupStyle == .single || timelineGroupStyle == .first ? 8 : 0
|
||||
|
||||
Reference in New Issue
Block a user