Implement additional text truncation settings

Changelog-Added: Added text truncation settings
This commit is contained in:
William Casarin
2023-04-05 10:32:32 -07:00
parent 9c8391b33b
commit f236ea52e1
3 changed files with 11 additions and 3 deletions

View File

@@ -212,7 +212,7 @@ struct EventGroupView: View {
NavigationLink(destination: dest) {
VStack(alignment: .leading) {
GroupDescription
EventBody(damus_state: state, event: event, size: .normal, options: [])
EventBody(damus_state: state, event: event, size: .normal, options: [.truncate_content])
.padding([.top], 1)
.padding([.trailing])
.foregroundColor(.gray)

View File

@@ -35,6 +35,14 @@ struct NotificationItemView: View {
notification_item_event(events: state.events, notif: item)
}
var options: EventViewOptions {
if state.settings.truncate_mention_text {
return [.wide, .truncate_content]
}
return [.wide]
}
func Item(_ ev: NostrEvent?) -> some View {
Group {
switch item {
@@ -52,7 +60,7 @@ struct NotificationItemView: View {
case .reply(let ev):
NavigationLink(destination: ThreadView(state: state, thread: ThreadModel(event: ev, damus_state: state))) {
EventView(damus: state, event: ev, options: [.wide, .truncate_content])
EventView(damus: state, event: ev, options: options)
}
.buttonStyle(.plain)
}