Compare commits
4 Commits
b25fa16548
...
59a1c6e035
| Author | SHA1 | Date | |
|---|---|---|---|
| 59a1c6e035 | |||
| 66ca1bb130 | |||
| 7a078f6b51 | |||
| 071d108ffb |
@ -267,30 +267,41 @@ struct PrivateChatView: View {
|
||||
isCurrentUser: Bool
|
||||
) -> some View {
|
||||
let timeText = timestamp(for: message)
|
||||
|
||||
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))
|
||||
.font(.body)
|
||||
.foregroundColor(isCurrentUser ? .white : .primary)
|
||||
.foregroundColor(foregroundColor)
|
||||
.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)
|
||||
.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)
|
||||
}
|
||||
}
|
||||
.offset(y: 3) // Move the timestamp view down
|
||||
}
|
||||
.padding(.vertical, 10)
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 15)
|
||||
.padding(.horizontal, 15)
|
||||
.background(
|
||||
MessageBubbleShape(
|
||||
decorationsEnabled: areBubbleDecorationsEnabled,
|
||||
showHornsRaw: decorations.showHorns,
|
||||
showLegsRaw: decorations.showLegs
|
||||
)
|
||||
.fill(bubbleColor)
|
||||
.fill(bubbleColor)
|
||||
)
|
||||
.frame(maxWidth: messageBubbleMaxWidth, alignment: isCurrentUser ? .trailing : .leading)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user