Compare commits

..

No commits in common. "59a1c6e035a3126e4785d357f5bac00f3954a89c" and "b25fa165487ae6fe7cb1df37e6e7e89a771b4e5a" have entirely different histories.

View File

@ -267,41 +267,30 @@ 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 foregroundColor = isCurrentUser ? Color.white : Color.primary
// Use a single HStack with bottom alignment to keep text and time on the same line, let bubbleColor = isCurrentUser ? Color.accentColor : Color(.secondarySystemBackground)
// with the time aligning to the bottom.
return HStack(alignment: .bottom, spacing: 8) { return VStack(alignment: isCurrentUser ? .trailing : .leading, spacing: 4) {
Text(contentText(for: message)) Text(contentText(for: message))
.font(.body) .font(.body)
.foregroundColor(foregroundColor) .foregroundColor(isCurrentUser ? .white : .primary)
.multilineTextAlignment(.leading) .multilineTextAlignment(.leading)
// This view contains the time and the optional checkmark. if !timeText.isEmpty {
// It's pushed to the right by the expanding Text view.
HStack(spacing: 4) {
Text(timeText) Text(timeText)
.font(.caption2) .font(.caption2)
.foregroundColor(isCurrentUser ? foregroundColor.opacity(0.85) : .secondary) .foregroundColor(isCurrentUser ? Color.white.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, 15) .padding(.vertical, 10)
.padding(.horizontal, 15) .padding(.horizontal, 12)
.background( .background(
MessageBubbleShape( MessageBubbleShape(
decorationsEnabled: areBubbleDecorationsEnabled, decorationsEnabled: areBubbleDecorationsEnabled,
showHornsRaw: decorations.showHorns, showHornsRaw: decorations.showHorns,
showLegsRaw: decorations.showLegs showLegsRaw: decorations.showLegs
) )
.fill(bubbleColor) .fill(bubbleColor)
) )
.frame(maxWidth: messageBubbleMaxWidth, alignment: isCurrentUser ? .trailing : .leading) .frame(maxWidth: messageBubbleMaxWidth, alignment: isCurrentUser ? .trailing : .leading)
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)