privatechatview patch
This commit is contained in:
parent
6d8b322688
commit
266742e15d
@ -128,7 +128,7 @@ struct PrivateChatView: View {
|
||||
|
||||
private func messageRow(for message: MessageItem) -> some View {
|
||||
let isCurrentUser = currentUserId.map { $0 == message.senderId } ?? false
|
||||
return HStack {
|
||||
return HStack(alignment: .bottom, spacing: 12) {
|
||||
if isCurrentUser { Spacer(minLength: 32) }
|
||||
|
||||
VStack(alignment: isCurrentUser ? .trailing : .leading, spacing: 6) {
|
||||
@ -141,7 +141,7 @@ struct PrivateChatView: View {
|
||||
Text(contentText(for: message))
|
||||
.font(.body)
|
||||
.foregroundColor(isCurrentUser ? .white : .primary)
|
||||
.frame(maxWidth: .infinity, alignment: isCurrentUser ? .trailing : .leading)
|
||||
.multilineTextAlignment(isCurrentUser ? .trailing : .leading)
|
||||
|
||||
Text(timestamp(for: message))
|
||||
.font(.caption2)
|
||||
@ -151,12 +151,18 @@ struct PrivateChatView: View {
|
||||
.padding(.horizontal, 12)
|
||||
.background(isCurrentUser ? Color.accentColor : Color(.secondarySystemBackground))
|
||||
.clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))
|
||||
.frame(maxWidth: messageBubbleMaxWidth, alignment: isCurrentUser ? .trailing : .leading)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
|
||||
if !isCurrentUser { Spacer(minLength: 32) }
|
||||
}
|
||||
.padding(.horizontal, 16)
|
||||
}
|
||||
|
||||
private var messageBubbleMaxWidth: CGFloat {
|
||||
min(UIScreen.main.bounds.width * 0.72, 360)
|
||||
}
|
||||
|
||||
private func senderName(for message: MessageItem) -> String {
|
||||
if let full = message.senderData?.fullName, !full.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
return full
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user