Only truncate timeline text if enabled in settings

Changelog-Changed: Only truncate timeline text if enabled in settings
This commit is contained in:
William Casarin
2023-04-03 11:30:05 -07:00
parent 094f63bcff
commit 4996272942
4 changed files with 20 additions and 3 deletions

View File

@@ -214,6 +214,8 @@ struct ConfigView: View {
.toggleStyle(.switch)
Toggle(NSLocalizedString("Zap Vibration", comment: "Setting to enable vibration on zap"), isOn: $settings.zap_vibration)
.toggleStyle(.switch)
Toggle(NSLocalizedString("Truncate text in timeline", comment: "Truncate text in timeline"), isOn: $settings.truncate_timeline_text)
.toggleStyle(.switch)
}
Section(NSLocalizedString("Images", comment: "Section title for images configuration.")) {

View File

@@ -80,7 +80,7 @@ struct TextEvent: View {
}
.padding(.horizontal)
EvBody(options: [.truncate_content, .pad_content])
EvBody(options: self.options.union(.pad_content))
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
Mention(mention)
@@ -149,7 +149,7 @@ struct TextEvent: View {
TopPart(is_anon: is_anon)
ReplyPart
EvBody(options: [])
EvBody(options: self.options)
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
Mention(mention)

View File

@@ -25,6 +25,14 @@ struct InnerTimelineView: View {
self._nav_target = State(initialValue: test_event)
}
var event_options: EventViewOptions {
if self.damus.settings.truncate_timeline_text {
return [.wide, .truncate_content]
}
return [.wide]
}
var body: some View {
let thread = ThreadModel(event: nav_target, damus_state: damus)
let dest = ThreadView(state: damus, thread: thread)
@@ -37,7 +45,7 @@ struct InnerTimelineView: View {
EmptyTimelineView()
} else {
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
EventView(damus: damus, event: ev, options: [.wide])
EventView(damus: damus, event: ev, options: event_options)
.onTapGesture {
nav_target = ev.inner_event ?? ev
navigating = true