fix: share private chat files and harden native lifecycle
This commit is contained in:
1 parent
7dcd06c911
commit
ec510b938b
8 files changed
+83
-15
No files matched your search
@@ -133,6 +133,7 @@ struct ChatDetailView: View {
|
||||
Color.clear.frame(height: 1).id("chat-bottom")
|
||||
}.padding(.horizontal, 20).padding(.vertical, 16).frame(maxWidth: 760)
|
||||
}
|
||||
.scrollDismissesKeyboard(.interactively)
|
||||
.simultaneousGesture(DragGesture().onChanged { _ in follow = false })
|
||||
.onChange(of: store.messages) { _, _ in if follow { proxy.scrollTo("chat-bottom", anchor: .bottom) } }
|
||||
.overlay(alignment: .bottomTrailing) {
|
||||
@@ -148,7 +149,7 @@ struct ChatDetailView: View {
|
||||
Button("Talk", systemImage: "waveform") { if let id = store.selected?.id { Task { await talk(id) } } }.disabled(store.activeRun != nil)
|
||||
Button("Export Markdown") { Task { await store.exportConversation(format: "markdown") } }
|
||||
Button("Export JSON") { Task { await store.exportConversation(format: "json") } }
|
||||
if let text = store.exportText { ShareLink("Share export", item: text) }
|
||||
if let file = store.exportFile { ShareLink("Share export file", item: file, preview: SharePreview(file.filename)) }
|
||||
} label: { Image(systemName: "ellipsis.circle").frame(minWidth: 44, minHeight: 44) }.accessibilityLabel("Chat actions")
|
||||
} }
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
@@ -193,7 +194,15 @@ struct RichChatMarkdown: View {
|
||||
}.padding(12).background(Color(uiColor: .secondarySystemBackground), in: RoundedRectangle(cornerRadius: 12))
|
||||
} else {
|
||||
ForEach(Array(block.text.components(separatedBy: "\n").enumerated()), id: \.offset) { _, line in
|
||||
if line.hasPrefix("# ") { markdown(String(line.dropFirst(2))).font(.title2.weight(.semibold)) }
|
||||
if line.trimmingCharacters(in: .whitespaces).hasPrefix("|"), line.contains("|") {
|
||||
let cells = line.split(separator: "|", omittingEmptySubsequences: true).map { String($0).trimmingCharacters(in: .whitespaces) }
|
||||
if !cells.allSatisfy({ $0.allSatisfy { "-: ".contains($0) } }) {
|
||||
HStack(alignment: .top, spacing: 12) { ForEach(Array(cells.enumerated()), id: \.offset) { _, cell in markdown(cell).frame(maxWidth: .infinity, alignment: .leading) } }
|
||||
.padding(.vertical, 6).accessibilityElement(children: .combine)
|
||||
Divider()
|
||||
}
|
||||
}
|
||||
else if line.hasPrefix("# ") { markdown(String(line.dropFirst(2))).font(.title2.weight(.semibold)) }
|
||||
else if line.hasPrefix("## ") { markdown(String(line.dropFirst(3))).font(.title3.weight(.semibold)) }
|
||||
else if line.hasPrefix("### ") { markdown(String(line.dropFirst(4))).font(.headline) }
|
||||
else if line.hasPrefix("- ") || line.hasPrefix("* ") { HStack(alignment: .top) { Text("•"); markdown(String(line.dropFirst(2))) } }
|
||||
|
||||
Reference in new issue
Block a user