Move timeline item tap gestures to the items themselves instead of the bubbled styler (#3553)

* Stop observing the timeline context where not necessary.
* Rename the timeline `itemTapped` action to `mediaTapped`
This commit is contained in:
Stefan Ceriu
2024-11-26 16:25:46 +02:00
committed by GitHub
parent 3f0f442937
commit 36980840ed
13 changed files with 53 additions and 29 deletions
@@ -124,11 +124,6 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
var messageBubbleWithActions: some View {
messageBubble
.onTapGesture {
context.send(viewAction: .itemTapped(itemID: timelineItem.id))
}
// We need a tap gesture before this long one so that it doesn't
// steal away the gestures from the scroll view
.longPressWithFeedback {
context.send(viewAction: .displayTimelineItemMenu(itemID: timelineItem.id))
}
@@ -396,6 +391,7 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
}
}
.environmentObject(viewModel.context)
.environment(\.timelineContext, viewModel.context)
}
static var replies: some View {
@@ -427,6 +423,7 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
groupStyle: .single))
}
.environmentObject(viewModel.context)
.environment(\.timelineContext, viewModel.context)
}
static var threads: some View {
@@ -434,6 +431,7 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
MockTimelineContent(isThreaded: true)
}
.environmentObject(viewModel.context)
.environment(\.timelineContext, viewModel.context)
}
static var pinned: some View {
@@ -441,6 +439,7 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
MockTimelineContent(isPinned: true)
}
.environmentObject(viewModelWithPins.context)
.environment(\.timelineContext, viewModel.context)
}
static var encryptionAuthenticity: some View {
@@ -523,6 +522,7 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
waveform: EstimatedWaveform.mockWaveform))
}
.environmentObject(viewModel.context)
.environment(\.timelineContext, viewModel.context)
}
}