mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Timestamp for media messages (#1057)
* timestamp for media messages * changelog
This commit is contained in:
@@ -130,8 +130,8 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
|||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
var styledContent: some View {
|
var styledContent: some View {
|
||||||
if shouldAvoidBubbling {
|
if isMediaType {
|
||||||
contentWithReply
|
contentWithTimestamp
|
||||||
.bubbleStyle(inset: false,
|
.bubbleStyle(inset: false,
|
||||||
cornerRadius: cornerRadius,
|
cornerRadius: cornerRadius,
|
||||||
corners: roundedCorners)
|
corners: roundedCorners)
|
||||||
@@ -147,11 +147,20 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
|||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
var contentWithTimestamp: some View {
|
var contentWithTimestamp: some View {
|
||||||
if isTextItem {
|
if isTextItem {
|
||||||
ZStack(alignment: .topLeading) {
|
ZStack(alignment: .bottomTrailing) {
|
||||||
contentWithReply
|
contentWithReply
|
||||||
.layoutPriority(1)
|
|
||||||
localizedSendInfo
|
localizedSendInfo
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
|
}
|
||||||
|
} else if isMediaType {
|
||||||
|
ZStack(alignment: .bottomTrailing) {
|
||||||
|
contentWithReply
|
||||||
|
localizedSendInfo
|
||||||
|
.padding(.horizontal, 4)
|
||||||
|
.padding(.vertical, 2)
|
||||||
|
.background(Color.element.system)
|
||||||
|
.cornerRadius(10)
|
||||||
|
.padding(.trailing, 4)
|
||||||
|
.padding(.bottom, 4)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
HStack(alignment: .bottom, spacing: 4) {
|
HStack(alignment: .bottom, spacing: 4) {
|
||||||
@@ -176,7 +185,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
|||||||
}
|
}
|
||||||
.font(.compound.bodyXS)
|
.font(.compound.bodyXS)
|
||||||
.foregroundColor(timelineItem.properties.deliveryStatus == .sendingFailed ? .element.alert : .element.secondaryContent)
|
.foregroundColor(timelineItem.properties.deliveryStatus == .sendingFailed ? .element.alert : .element.secondaryContent)
|
||||||
.padding(.bottom, -4)
|
.padding(.bottom, isMediaType ? 0 : -4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
@@ -213,7 +222,7 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
|||||||
return timelineGroupStyle == .single || timelineGroupStyle == .first ? 8 : 0
|
return timelineGroupStyle == .single || timelineGroupStyle == .first ? 8 : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
private var shouldAvoidBubbling: Bool {
|
private var isMediaType: Bool {
|
||||||
timelineItem is ImageRoomTimelineItem || timelineItem is VideoRoomTimelineItem || timelineItem is StickerRoomTimelineItem
|
timelineItem is ImageRoomTimelineItem || timelineItem is VideoRoomTimelineItem || timelineItem is StickerRoomTimelineItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ struct ImageRoomTimelineView_Previews: PreviewProvider {
|
|||||||
static let viewModel = RoomScreenViewModel.mock
|
static let viewModel = RoomScreenViewModel.mock
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
body.environmentObject(viewModel.context)
|
body
|
||||||
|
.environmentObject(viewModel.context)
|
||||||
body
|
body
|
||||||
.environment(\.timelineStyle, .plain)
|
.environment(\.timelineStyle, .plain)
|
||||||
.environmentObject(viewModel.context)
|
.environmentObject(viewModel.context)
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Timestamp added to non bubbled messages like images and videos for bubble style.
|
||||||
Reference in New Issue
Block a user