From 266742e15dcca24cc2fd8720899d1d903dfaff78 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Wed, 22 Oct 2025 03:51:34 +0300 Subject: [PATCH] privatechatview patch --- yobble/Views/Chat/PrivateChatView.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/yobble/Views/Chat/PrivateChatView.swift b/yobble/Views/Chat/PrivateChatView.swift index f7d41fc..38980d7 100644 --- a/yobble/Views/Chat/PrivateChatView.swift +++ b/yobble/Views/Chat/PrivateChatView.swift @@ -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