Skip to content

Commit

Permalink
Rename the timeline itemTapped action to mediaTapped
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Nov 26, 2024
1 parent bf9a13c commit dbb7dc0
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ElementX/Sources/Other/SwiftUI/Views/LoadableImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private struct LoadableImageContent<TransformerView: View, PlaceholderView: View
ZStack {
Color.black.opacity(0.6)
.contentShape(.rect)
.onTapGesture { /* Empty gesture to block the itemTapped action */ }
.onTapGesture { /* Empty gesture to block the `mediaTapped` action */ }

// Don't use a real Button as it sometimes triggers simultaneously with the long press gesture.
Text(L10n.actionShow)
Expand Down
2 changes: 1 addition & 1 deletion ElementX/Sources/Screens/Timeline/TimelineModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum TimelineViewAction {
case itemAppeared(itemID: TimelineItemIdentifier)
case itemDisappeared(itemID: TimelineItemIdentifier)

case itemTapped(itemID: TimelineItemIdentifier)
case mediaTapped(itemID: TimelineItemIdentifier)
case itemSendInfoTapped(itemID: TimelineItemIdentifier)
case toggleReaction(key: String, itemID: TimelineItemIdentifier)
case sendReadReceiptIfNeeded(TimelineItemIdentifier)
Expand Down
6 changes: 3 additions & 3 deletions ElementX/Sources/Screens/Timeline/TimelineViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
Task { await timelineController.processItemAppearance(id) }
case .itemDisappeared(let id):
Task { await timelineController.processItemDisappearance(id) }
case .itemTapped(let id):
Task { await handleItemTapped(with: id) }
case .mediaTapped(let id):
Task { await handleMediaTapped(with: id) }
case .itemSendInfoTapped(let itemID):
handleItemSendInfoTapped(itemID: itemID)
case .toggleReaction(let emoji, let itemID):
Expand Down Expand Up @@ -533,7 +533,7 @@ class TimelineViewModel: TimelineViewModelType, TimelineViewModelProtocol {
await timelineController.sendReadReceipt(for: lastVisibleItemID)
}

private func handleItemTapped(with itemID: TimelineItemIdentifier) async {
private func handleMediaTapped(with itemID: TimelineItemIdentifier) async {
state.showLoading = true
let action = await timelineInteractionHandler.processItemTap(itemID)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct AudioRoomTimelineView: View {
.padding(.horizontal, 6)
.accessibilityLabel(L10n.commonAudio)
.onTapGesture {
context?.send(viewAction: .itemTapped(itemID: timelineItem.id))
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct FileRoomTimelineView: View {
.padding(.horizontal, 6)
.accessibilityLabel(L10n.commonFile)
.onTapGesture {
context?.send(viewAction: .itemTapped(itemID: timelineItem.id))
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ImageRoomTimelineView: View {
// operates on the entire message so wouldn't round the bottom corners.
.clipShape(RoundedRectangle(cornerRadius: hasMediaCaption ? 6 : 0))
.onTapGesture {
context?.send(viewAction: .itemTapped(itemID: timelineItem.id))
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}

if let attributedCaption = timelineItem.content.formattedCaption {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct LocationRoomTimelineView: View {
.accessibilityElement(children: .ignore)
.accessibilityLabel(accessibilityLabel)
.onTapGesture {
context?.send(viewAction: .itemTapped(itemID: timelineItem.id))
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct StickerRoomTimelineView: View {
.accessibilityElement(children: .ignore)
.accessibilityLabel("\(L10n.commonSticker), \(timelineItem.body)")
.onTapGesture {
context?.send(viewAction: .itemTapped(itemID: timelineItem.id))
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct VideoRoomTimelineView: View {
// operates on the entire message so wouldn't round the bottom corners.
.clipShape(RoundedRectangle(cornerRadius: hasMediaCaption ? 6 : 0))
.onTapGesture {
context?.send(viewAction: .itemTapped(itemID: timelineItem.id))
context?.send(viewAction: .mediaTapped(itemID: timelineItem.id))
}

if let attributedCaption = timelineItem.content.formattedCaption {
Expand Down

0 comments on commit dbb7dc0

Please sign in to comment.