Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timestamp for media messages #1057

Merged
merged 2 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ struct TimelineItemBubbledStylerView<Content: View>: View {

@ViewBuilder
var styledContent: some View {
if shouldAvoidBubbling {
contentWithReply
if isMediaType {
contentWithTimestamp
.bubbleStyle(inset: false,
cornerRadius: cornerRadius,
corners: roundedCorners)
Expand All @@ -147,11 +147,20 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
@ViewBuilder
var contentWithTimestamp: some View {
if isTextItem {
ZStack(alignment: .topLeading) {
ZStack(alignment: .bottomTrailing) {
contentWithReply
localizedSendInfo
}
} else if isMediaType {
ZStack(alignment: .bottomTrailing) {
contentWithReply
.layoutPriority(1)
localizedSendInfo
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
.padding(.horizontal, 4)
.padding(.vertical, 2)
.background(Color.element.system)
.cornerRadius(10)
.padding(.trailing, 4)
.padding(.bottom, 4)
}
} else {
HStack(alignment: .bottom, spacing: 4) {
Expand All @@ -176,7 +185,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
}
.font(.compound.bodyXS)
.foregroundColor(timelineItem.properties.deliveryStatus == .sendingFailed ? .element.alert : .element.secondaryContent)
.padding(.bottom, -4)
.padding(.bottom, isMediaType ? 0 : -4)
}

@ViewBuilder
Expand Down Expand Up @@ -213,7 +222,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
return timelineGroupStyle == .single || timelineGroupStyle == .first ? 8 : 0
}

private var shouldAvoidBubbling: Bool {
private var isMediaType: Bool {
timelineItem is ImageRoomTimelineItem || timelineItem is VideoRoomTimelineItem || timelineItem is StickerRoomTimelineItem
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ struct ImageRoomTimelineView_Previews: PreviewProvider {
static let viewModel = RoomScreenViewModel.mock

static var previews: some View {
body.environmentObject(viewModel.context)
body
.environmentObject(viewModel.context)
body
.environment(\.timelineStyle, .plain)
.environmentObject(viewModel.context)
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-1057.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Timestamp added to non bubbled messages like images and videos for bubble style.