Files
simplex-chat/apps/ios/Shared/Views/Chat/ChatItem/EmojiItemView.swift
T
Evgeny @ SimpleX Chat aceb646f95 core, ui: typed empty lines are shown, and the flat chat layout reads as paragraphs (#8023)
* ui: markdown messages show the empty lines that were typed

* ui: snapshot references of messages with empty lines

* ui: terminal layout spacing by one paragraph unit, names at text size

* ui: terminal gap below reactions, same empty lines in both apps

* ui: flat layout references with the paragraph unit

* core, ui: text with empty lines as paragraphs, ios bubbles fit text

* core, ui: move text with empty lines as paragraphs to a follow-up

* ui: ios references with bubbles that fit their text

* ui: other senders' names in the flat layout in the secondary colour

* core, ui: text with empty lines as paragraphs

* core, ui: single-star text italic, reports drawn without core prefix
2026-11-04 13:27:22 +00:00

55 lines
1.8 KiB
Swift

//
// EmojiItemView.swift
// SimpleX
//
// Created by Evgeny Poberezkin on 04/02/2022.
// Copyright © 2022 SimpleX Chat. All rights reserved.
//
// Spec: spec/client/chat-view.md
import SwiftUI
import SimpleXChat
// Spec: spec/client/chat-view.md#EmojiItemView
struct EmojiItemView: View {
@ObservedObject var chat: Chat
@EnvironmentObject var theme: AppTheme
var chatItem: ChatItem
var body: some View {
ItemWithMeta(metaReserved: true) {
CIMetaView(chat: chat, chatItem: chatItem, metaColor: theme.colors.secondary)
} content: { inlineMeta in
if let inlineMeta {
VStack(spacing: 1) {
emojiText(chatItem.content.text)
.padding(.top, 8)
.padding(.horizontal, 6)
inlineMeta
.padding(.bottom, 8)
.padding(.horizontal, 12)
}
} else {
emojiText(chatItem.content.text)
.modifier(MessageLastLine())
.padding(EdgeInsets(top: 0, leading: chatItemTextPadding, bottom: terminalCardBottomGap(chatItem), trailing: chatItemTextPadding))
}
}
}
}
func emojiText(_ text: String) -> Text {
let s = text.trimmingCharacters(in: .whitespaces)
return Text(s).font(s.count < 4 ? largeEmojiFont : mediumEmojiFont)
}
struct EmojiItemView_Previews: PreviewProvider {
static var previews: some View {
Group{
EmojiItemView(chat: Chat.sampleData, chatItem: ChatItem.getSample(1, .directSnd, previewDate, "🙂", .sndSent(sndProgress: .complete)))
EmojiItemView(chat: Chat.sampleData, chatItem: ChatItem.getSample(2, .directRcv, previewDate, "👍"))
}
.previewLayout(.fixed(width: 360, height: 70))
}
}