Добавлено gasText в ChatMessage #13
iOS CI / Build and Test SwiftUI App (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s

This commit is contained in:
wt committed 2026-08-28 15:10:37 +07:00
1 parent fe2b14ecee
commit 4c16644b69
1 file changed
+13 -1
+13 -1
View File
@@ -167,7 +167,8 @@ final class ChatMessage {
var quotePreview: String {
if isRetracted { return "Сообщение удалено" }
let value = kind == .text ? body : previewText
let normalized = value
let normalized =
value
.replacingOccurrences(of: "\n", with: " ")
.trimmingCharacters(in: .whitespacesAndNewlines)
guard normalized.count > 140 else { return normalized }
@@ -264,4 +265,15 @@ final class ChatMessage {
let bare = value[..<slash].lowercased()
return bare + String(value[slash...])
}
var hasText: Bool {
// 1. Удалённые сообщения не копируем
guard !isRetracted else { return false }
// 2. Исключаем системные уведомления
guard kind != .system else { return false }
// 3. Текст считается существующим, если body не пустая строка (с обрезкой пробелов)
return !body.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
}