ios: fix scrolling with link previews, fix large terminal item detail view (#512)

This commit is contained in:
Evgeny Poberezkin 2022-04-08 19:58:02 +01:00 committed by GitHub
parent 84a77de53c
commit 150b4196ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 10 deletions

View file

@ -52,9 +52,7 @@ struct FramedItemView: View {
.padding(.bottom, 2)
} else {
if case let .link(_, preview) = chatItem.content.msgContent {
ChatItemLinkView(linkPreview: preview, width: msgWidth)
.overlay(DetermineWidth())
.frame(minWidth: msgWidth, alignment: .leading)
ChatItemLinkView(linkPreview: preview)
}
MsgContentView(
content: chatItem.content,

File diff suppressed because one or more lines are too long

View file

@ -10,6 +10,8 @@ import SwiftUI
private let terminalFont = Font.custom("Menlo", size: 16)
private let maxItemSize: Int = 50000
struct TerminalView: View {
@EnvironmentObject var chatModel: ChatModel
@State var inProgress: Bool = false
@ -24,11 +26,18 @@ struct TerminalView: View {
LazyVStack {
ForEach(chatModel.terminalItems) { item in
NavigationLink {
let s = item.details
ScrollView {
Text(item.details)
.textSelection(.enabled)
Text(s.prefix(maxItemSize))
.padding()
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
Button { showShareSheet(items: [s]) } label: {
Image(systemName: "square.and.arrow.up")
}
}
}
} label: {
HStack {
Text(item.id.formatted(date: .omitted, time: .standard))