diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/AudioFileEventsTimelineView.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/AudioFileEventsTimelineView.swift index 0327245f4..ab65d2e46 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/AudioFileEventsTimelineView.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/AudioFileEventsTimelineView.swift @@ -21,7 +21,7 @@ struct AudioMediaEventsTimelineView: View { isAudioFile: true) .accessibilityLabel(L10n.commonAudio) .frame(maxWidth: .infinity, alignment: .leading) - .bubbleBackground(timelineItem: timelineItem, + .bubbleBackground(isOutgoing: timelineItem.isOutgoing, insets: .init(top: 8, leading: 12, bottom: 8, trailing: 12), color: .compound.bgSubtleSecondary) } diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/FileMediaEventsTimelineView.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/FileMediaEventsTimelineView.swift index e742fe836..37506e4d7 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/FileMediaEventsTimelineView.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/FileMediaEventsTimelineView.swift @@ -20,7 +20,7 @@ struct FileMediaEventsTimelineView: View { additionalWhitespaces: timelineItem.additionalWhitespaces()) .accessibilityLabel(L10n.commonFile) .frame(maxWidth: .infinity, alignment: .leading) - .bubbleBackground(timelineItem: timelineItem, + .bubbleBackground(isOutgoing: timelineItem.isOutgoing, insets: .init(top: 8, leading: 12, bottom: 8, trailing: 12), color: .compound.bgSubtleSecondary) } diff --git a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VoiceMessageMediaEventsTimelineView.swift b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VoiceMessageMediaEventsTimelineView.swift index 5987e1ac9..49e7bede4 100644 --- a/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VoiceMessageMediaEventsTimelineView.swift +++ b/ElementX/Sources/Screens/MediaEventsTimelineScreen/View/TimelineViews/VoiceMessageMediaEventsTimelineView.swift @@ -17,7 +17,7 @@ struct VoiceMessageMediaEventsTimelineView: View { playerState: playerState) .accessibilityLabel(L10n.commonVoiceMessage) .frame(maxWidth: .infinity, alignment: .leading) - .bubbleBackground(timelineItem: timelineItem, + .bubbleBackground(isOutgoing: timelineItem.isOutgoing, insets: .init(top: 8, leading: 12, bottom: 8, trailing: 12), color: .compound.bgSubtleSecondary) } diff --git a/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbleBackground.swift b/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbleBackground.swift index 2bb7c2369..22704669e 100644 --- a/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbleBackground.swift +++ b/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbleBackground.swift @@ -8,10 +8,10 @@ import SwiftUI extension View { - func bubbleBackground(timelineItem: EventBasedTimelineItemProtocol, + func bubbleBackground(isOutgoing: Bool, insets: EdgeInsets, color: Color? = nil) -> some View { - modifier(TimelineItemBubbleBackgroundModifier(timelineItem: timelineItem, + modifier(TimelineItemBubbleBackgroundModifier(isOutgoing: isOutgoing, insets: insets, color: color)) } @@ -20,7 +20,7 @@ extension View { private struct TimelineItemBubbleBackgroundModifier: ViewModifier { @Environment(\.timelineGroupStyle) private var timelineGroupStyle - let timelineItem: EventBasedTimelineItemProtocol + let isOutgoing: Bool let insets: EdgeInsets var color: Color? @@ -36,15 +36,15 @@ private struct TimelineItemBubbleBackgroundModifier: ViewModifier { case .single: return .allCorners case .first: - if timelineItem.isOutgoing { + if isOutgoing { return [.topLeft, .topRight, .bottomLeft] } else { return [.topLeft, .topRight, .bottomRight] } case .middle: - return timelineItem.isOutgoing ? [.topLeft, .bottomLeft] : [.topRight, .bottomRight] + return isOutgoing ? [.topLeft, .bottomLeft] : [.topRight, .bottomRight] case .last: - if timelineItem.isOutgoing { + if isOutgoing { return [.topLeft, .bottomLeft, .bottomRight] } else { return [.topRight, .bottomLeft, .bottomRight] diff --git a/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift b/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift index b4245e7a4..1a3998635 100644 --- a/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift +++ b/ElementX/Sources/Screens/Timeline/View/Style/TimelineItemBubbledStylerView.swift @@ -163,7 +163,7 @@ struct TimelineItemBubbledStylerView: View { var messageBubble: some View { contentWithReply .timelineItemSendInfo(timelineItem: timelineItem, adjustedDeliveryStatus: adjustedDeliveryStatus, context: context) - .bubbleBackground(timelineItem: timelineItem, + .bubbleBackground(isOutgoing: timelineItem.isOutgoing, insets: timelineItem.bubbleInsets, color: timelineItem.bubbleBackgroundColor) }