Compare commits

...

9 Commits

Author SHA1 Message Date
c694270a8f Fix notifications to show previews and allow tapping reaction text to navigate to threaded event 2023-03-27 10:34:12 -04:00
William Casarin
0b40cd127c Revert "Revert "Don't make previews full bleed""
This reverts commit 57006b928b.
2023-03-26 09:36:02 -06:00
William Casarin
754ee254e9 Revert "Revert "New Timeline""
This reverts commit f5ed9cd5d4.
2023-03-26 09:35:53 -06:00
William Casarin
963cb37762 Revert "Increase image size"
This reverts commit b6d5b6f45e.
2023-03-26 09:35:07 -06:00
William Casarin
159d0fa2b5 Don't render @note link if there is only one 2023-03-25 07:54:04 -06:00
William Casarin
61fddf800e Reduced padding for more information density
Changelog-Changed: Reduced padding for more information density
2023-03-25 06:51:56 -06:00
William Casarin
b6d5b6f45e Increase image size 2023-03-25 06:38:06 -06:00
William Casarin
f5ed9cd5d4 Revert "New Timeline"
This reverts commit f84d4516db.
2023-03-25 06:31:24 -06:00
William Casarin
57006b928b Revert "Don't make previews full bleed"
This reverts commit 98f0b2f2d2.
2023-03-25 06:31:18 -06:00
4 changed files with 27 additions and 7 deletions

View File

@@ -94,6 +94,14 @@ enum Block {
return nil return nil
} }
var is_note_mention: Bool {
guard case .mention(let mention) = self else {
return false
}
return mention.type == .event
}
var is_mention: Bool { var is_mention: Bool {
if case .mention = self { if case .mention = self {
return true return true

View File

@@ -240,6 +240,7 @@ struct NoteArtifacts {
func render_note_content(ev: NostrEvent, profiles: Profiles, privkey: String?) -> NoteArtifacts { func render_note_content(ev: NostrEvent, profiles: Profiles, privkey: String?) -> NoteArtifacts {
let blocks = ev.blocks(privkey) let blocks = ev.blocks(privkey)
return render_blocks(blocks: blocks, profiles: profiles, privkey: privkey) return render_blocks(blocks: blocks, profiles: profiles, privkey: privkey)
} }
@@ -247,9 +248,17 @@ func render_blocks(blocks: [Block], profiles: Profiles, privkey: String?) -> Not
var invoices: [Invoice] = [] var invoices: [Invoice] = []
var img_urls: [URL] = [] var img_urls: [URL] = []
var link_urls: [URL] = [] var link_urls: [URL] = []
let one_note_ref = blocks
.filter({ $0.is_note_mention })
.count == 1
let txt: AttributedString = blocks.reduce("") { str, block in let txt: AttributedString = blocks.reduce("") { str, block in
switch block { switch block {
case .mention(let m): case .mention(let m):
if m.type == .event && one_note_ref {
return str
}
return str + mention_str(m, profiles: profiles) return str + mention_str(m, profiles: profiles)
case .text(let txt): case .text(let txt):
return str + AttributedString(stringLiteral: txt) return str + AttributedString(stringLiteral: txt)

View File

@@ -206,17 +206,20 @@ struct EventGroupView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
ProfilePicturesView(state: state, events: group.events) ProfilePicturesView(state: state, events: group.events)
GroupDescription
if let event { if let event {
let thread = ThreadModel(event: event, damus_state: state) let thread = ThreadModel(event: event, damus_state: state)
let dest = ThreadView(state: state, thread: thread) let dest = ThreadView(state: state, thread: thread)
NavigationLink(destination: dest) { NavigationLink(destination: dest) {
Text(render_note_content(ev: event, profiles: state.profiles, privkey: state.keypair.privkey).content) VStack(alignment: .leading) {
.padding([.top], 1) GroupDescription
.foregroundColor(.gray) EventBody(damus_state: state, event: event, size: .normal, options: [])
.padding([.top], 1)
.foregroundColor(.gray)
}
} }
.buttonStyle(.plain) .buttonStyle(.plain)
} else {
GroupDescription
} }
} }
} }

View File

@@ -42,10 +42,10 @@ struct InnerTimelineView: View {
nav_target = ev.inner_event ?? ev nav_target = ev.inner_event ?? ev
navigating = true navigating = true
} }
.padding(.top, 10) .padding(.top, 7)
Divider() Divider()
.padding([.top], 10) .padding([.top], 7)
} }
} }
} }