Only show longform preview in notifications

Changelog-Fixed: Show longform previews in notifications instead of the entire post
This commit is contained in:
William Casarin
2023-07-11 12:56:30 -07:00
parent ad6a1962bb
commit de4e8e5748
2 changed files with 50 additions and 20 deletions

View File

@@ -21,19 +21,24 @@ struct EventBody: View {
self.options = options
self.should_show_img = should_show_img ?? should_show_images(settings: damus_state.settings, contacts: damus_state.contacts, ev: event, our_pubkey: damus_state.pubkey)
}
var body: some View {
if event.known_kind == .longform {
let longform = LongformEvent.parse(from: event)
Text(longform.title ?? "Untitled")
.font(.title)
.padding(.horizontal)
}
var note_content: some View {
NoteContentView(damus_state: damus_state, event: event, show_images: should_show_img, size: size, options: options)
.frame(maxWidth: .infinity, alignment: .leading)
}
var body: some View {
if event.known_kind == .longform {
LongformPreviewBody(state: damus_state, ev: event, options: options)
// truncated longform bodies are just the preview
if !options.contains(.truncate_content) {
note_content
}
} else {
note_content
}
}
}
struct EventBody_Previews: PreviewProvider {