From 59d2f8c161f9865131165a2e0ebdc1bb253ce1e2 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Fri, 12 Dec 2025 01:51:35 +0300 Subject: [PATCH] ios 15 --- yobble/Views/Chat/PrivateChatView.swift | 303 ++++++++++++++++-------- 1 file changed, 206 insertions(+), 97 deletions(-) diff --git a/yobble/Views/Chat/PrivateChatView.swift b/yobble/Views/Chat/PrivateChatView.swift index 730f129..c31e5cb 100644 --- a/yobble/Views/Chat/PrivateChatView.swift +++ b/yobble/Views/Chat/PrivateChatView.swift @@ -244,104 +244,213 @@ struct PrivateChatView: View { let topPadding: CGFloat = decoratedMessage.showHorns ? 5 : -12 let verticalPadding: CGFloat = hasDecorations ? 0 : 0 - - return HStack(alignment: .bottom, spacing: 8) { - if isCurrentUser { Spacer(minLength: 32) } - - messageBubble( - for: message, - decorations: decoratedMessage, - isCurrentUser: isCurrentUser - ) - - if !isCurrentUser { Spacer(minLength: 32) } - } - .padding(.horizontal, 8) - .padding(.top, topPadding) - .padding(.vertical, verticalPadding) - .contextMenu { - if isCurrentUser { - if message.isViewed == true { - Text("Прочитано") // Placeholder for read status + + if #available(iOS 16.0, *) { + return HStack(alignment: .bottom, spacing: 8) { + if isCurrentUser { Spacer(minLength: 32) } + + messageBubble( + for: message, + decorations: decoratedMessage, + isCurrentUser: isCurrentUser + ) + + if !isCurrentUser { Spacer(minLength: 32) } + } + .padding(.horizontal, 8) + .padding(.top, topPadding) + .padding(.vertical, verticalPadding) + .contextMenu(menuItems: { + if isCurrentUser { + if message.isViewed == true { + Text("Прочитано") // Placeholder for read status + } + Button(action: { + // Reply action + }) { + Text("Ответить") + Image(systemName: "arrowshape.turn.up.left") + } + Button(action: { + // Copy action + }) { + Text("Копировать") + Image(systemName: "doc.on.doc") + } + Button(action: { + // Edit action + }) { + Text("Изменить") + Image(systemName: "pencil") + } + Button(action: { + // Pin action + }) { + Text("Закрепить") + Image(systemName: "pin") + } + Button(action: { + // Forward action + }) { + Text("Переслать") + Image(systemName: "arrowshape.turn.up.right") + } + Button(role: .destructive, action: { + // Delete action + }) { + Text("Удалить") + Image(systemName: "trash") + } + Button(action: { + // Select action + }) { + Text("Выбрать") + Image(systemName: "checkmark.circle") + } + } else { + Button(action: { + // Reply action + }) { + Text("Ответить") + Image(systemName: "arrowshape.turn.up.left") + } + Button(action: { + // Copy action + }) { + Text("Копировать") + Image(systemName: "doc.on.doc") + } + Button(action: { + // Pin action + }) { + Text("Закрепить") + Image(systemName: "pin") + } + Button(action: { + // Forward action + }) { + Text("Переслать") + Image(systemName: "arrowshape.turn.up.right") + } + Button(role: .destructive, action: { + // Delete action + }) { + Text("Удалить") + Image(systemName: "trash") + } + Button(action: { + // Select action + }) { + Text("Выбрать") + Image(systemName: "checkmark.circle") + } } - Button(action: { - // Reply action - }) { - Text("Ответить") - Image(systemName: "arrowshape.turn.up.left") - } - Button(action: { - // Copy action - }) { - Text("Копировать") - Image(systemName: "doc.on.doc") - } - Button(action: { - // Edit action - }) { - Text("Изменить") - Image(systemName: "pencil") - } - Button(action: { - // Pin action - }) { - Text("Закрепить") - Image(systemName: "pin") - } - Button(action: { - // Forward action - }) { - Text("Переслать") - Image(systemName: "arrowshape.turn.up.right") - } - Button(role: .destructive, action: { - // Delete action - }) { - Text("Удалить") - Image(systemName: "trash") - } - Button(action: { - // Select action - }) { - Text("Выбрать") - Image(systemName: "checkmark.circle") - } - } else { - Button(action: { - // Reply action - }) { - Text("Ответить") - Image(systemName: "arrowshape.turn.up.left") - } - Button(action: { - // Copy action - }) { - Text("Копировать") - Image(systemName: "doc.on.doc") - } - Button(action: { - // Pin action - }) { - Text("Закрепить") - Image(systemName: "pin") - } - Button(action: { - // Forward action - }) { - Text("Переслать") - Image(systemName: "arrowshape.turn.up.right") - } - Button(role: .destructive, action: { - // Delete action - }) { - Text("Удалить") - Image(systemName: "trash") - } - Button(action: { - // Select action - }) { - Text("Выбрать") - Image(systemName: "checkmark.circle") + }, preview: { + messageBubble( + for: message, + decorations: decoratedMessage, + isCurrentUser: isCurrentUser + ) + }) + } else { + return HStack(alignment: .bottom, spacing: 8) { + if isCurrentUser { Spacer(minLength: 32) } + + messageBubble( + for: message, + decorations: decoratedMessage, + isCurrentUser: isCurrentUser + ) + + if !isCurrentUser { Spacer(minLength: 32) } + } + .padding(.horizontal, 8) + .padding(.top, topPadding) + .padding(.vertical, verticalPadding) + .contextMenu { + if isCurrentUser { + if message.isViewed == true { + Text("Прочитано") // Placeholder for read status + } + Button(action: { + // Reply action + }) { + Text("Ответить") + Image(systemName: "arrowshape.turn.up.left") + } + Button(action: { + // Copy action + }) { + Text("Копировать") + Image(systemName: "doc.on.doc") + } + Button(action: { + // Edit action + }) { + Text("Изменить") + Image(systemName: "pencil") + } + Button(action: { + // Pin action + }) { + Text("Закрепить") + Image(systemName: "pin") + } + Button(action: { + // Forward action + }) { + Text("Переслать") + Image(systemName: "arrowshape.turn.up.right") + } + Button(role: .destructive, action: { + // Delete action + }) { + Text("Удалить") + Image(systemName: "trash") + } + Button(action: { + // Select action + }) { + Text("Выбрать") + Image(systemName: "checkmark.circle") + } + } else { + Button(action: { + // Reply action + }) { + Text("Ответить") + Image(systemName: "arrowshape.turn.up.left") + } + Button(action: { + // Copy action + }) { + Text("Копировать") + Image(systemName: "doc.on.doc") + } + Button(action: { + // Pin action + }) { + Text("Закрепить") + Image(systemName: "pin") + } + Button(action: { + // Forward action + }) { + Text("Переслать") + Image(systemName: "arrowshape.turn.up.right") + } + Button(role: .destructive, action: { + // Delete action + }) { + Text("Удалить") + Image(systemName: "trash") + } + Button(action: { + // Select action + }) { + Text("Выбрать") + Image(systemName: "checkmark.circle") + } } } }