Merge branch 'master' into event-cleanup

This commit is contained in:
Sam DuBois
2022-12-27 17:42:37 -07:00
committed by GitHub
20 changed files with 605 additions and 60 deletions

View File

@@ -67,6 +67,7 @@ struct NoteContentView: View {
@State var artifacts: NoteArtifacts
@State var metaData: [LPLinkMetadata] = []
let size: EventViewKind
func MainContent() -> some View {
let md_opts: AttributedString.MarkdownParsingOptions =
@@ -75,10 +76,10 @@ struct NoteContentView: View {
return VStack(alignment: .leading) {
if let txt = try? AttributedString(markdown: artifacts.content, options: md_opts) {
Text(txt)
.font(.body)
.font(eventviewsize_to_font(size))
} else {
Text(artifacts.content)
.font(.body)
.font(eventviewsize_to_font(size))
}
if show_images && artifacts.images.count > 0 {
ImageCarousel(urls: artifacts.images)
@@ -150,8 +151,8 @@ func mention_str(_ m: Mention, profiles: Profiles) -> String {
let disp = Profile.displayName(profile: profile, pubkey: pk)
return "[@\(disp)](nostr:\(encode_pubkey_uri(m.ref)))"
case .event:
let evid = m.ref.ref_id
return "[&\(abbrev_pubkey(evid))](nostr:\(encode_event_id_uri(m.ref)))"
let bevid = bech32_note_id(m.ref.ref_id) ?? m.ref.ref_id
return "[@\(abbrev_pubkey(bevid))](nostr:\(encode_event_id_uri(m.ref)))"
}
}
@@ -161,6 +162,6 @@ struct NoteContentView_Previews: PreviewProvider {
let state = test_damus_state()
let content = "hi there https://jb55.com/s/Oct12-150217.png 5739a762ef6124dd.jpg"
let artifacts = NoteArtifacts(content: content, images: [], invoices: [], links: [])
NoteContentView(privkey: "", event: NostrEvent(content: content, pubkey: "pk"), profiles: state.profiles, show_images: true, artifacts: artifacts)
NoteContentView(privkey: "", event: NostrEvent(content: content, pubkey: "pk"), profiles: state.profiles, show_images: true, artifacts: artifacts, size: .normal)
}
}