Compare commits
4 Commits
b25fa16548
...
59a1c6e035
| Author | SHA1 | Date | |
|---|---|---|---|
| 59a1c6e035 | |||
| 66ca1bb130 | |||
| 7a078f6b51 | |||
| 071d108ffb |
@ -267,23 +267,34 @@ struct PrivateChatView: View {
|
|||||||
isCurrentUser: Bool
|
isCurrentUser: Bool
|
||||||
) -> some View {
|
) -> some View {
|
||||||
let timeText = timestamp(for: message)
|
let timeText = timestamp(for: message)
|
||||||
|
|
||||||
let bubbleColor = isCurrentUser ? Color.accentColor : Color(.secondarySystemBackground)
|
let bubbleColor = isCurrentUser ? Color.accentColor : Color(.secondarySystemBackground)
|
||||||
|
let foregroundColor = isCurrentUser ? Color.white : Color.primary
|
||||||
|
|
||||||
return VStack(alignment: isCurrentUser ? .trailing : .leading, spacing: 4) {
|
// Use a single HStack with bottom alignment to keep text and time on the same line,
|
||||||
|
// with the time aligning to the bottom.
|
||||||
|
return HStack(alignment: .bottom, spacing: 8) {
|
||||||
Text(contentText(for: message))
|
Text(contentText(for: message))
|
||||||
.font(.body)
|
.font(.body)
|
||||||
.foregroundColor(isCurrentUser ? .white : .primary)
|
.foregroundColor(foregroundColor)
|
||||||
.multilineTextAlignment(.leading)
|
.multilineTextAlignment(.leading)
|
||||||
|
|
||||||
if !timeText.isEmpty {
|
// This view contains the time and the optional checkmark.
|
||||||
|
// It's pushed to the right by the expanding Text view.
|
||||||
|
HStack(spacing: 4) {
|
||||||
Text(timeText)
|
Text(timeText)
|
||||||
.font(.caption2)
|
.font(.caption2)
|
||||||
.foregroundColor(isCurrentUser ? Color.white.opacity(0.85) : .secondary)
|
.foregroundColor(isCurrentUser ? foregroundColor.opacity(0.85) : .secondary)
|
||||||
|
|
||||||
|
if isCurrentUser {
|
||||||
|
Image(systemName: (message.isViewed ?? false) ? "checkmark.circle.fill" : "checkmark.circle")
|
||||||
|
.font(.system(size: 12, weight: .semibold))
|
||||||
|
.foregroundColor(isCurrentUser ? foregroundColor.opacity(0.85) : .secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.padding(.vertical, 10)
|
.offset(y: 3) // Move the timestamp view down
|
||||||
.padding(.horizontal, 12)
|
}
|
||||||
|
.padding(.vertical, 15)
|
||||||
|
.padding(.horizontal, 15)
|
||||||
.background(
|
.background(
|
||||||
MessageBubbleShape(
|
MessageBubbleShape(
|
||||||
decorationsEnabled: areBubbleDecorationsEnabled,
|
decorationsEnabled: areBubbleDecorationsEnabled,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user