Only truncate timeline text if enabled in settings
Changelog-Changed: Only truncate timeline text if enabled in settings
This commit is contained in:
@@ -128,6 +128,12 @@ class UserSettingsStore: ObservableObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Published var truncate_timeline_text: Bool {
|
||||||
|
didSet {
|
||||||
|
UserDefaults.standard.set(truncate_timeline_text, forKey: "truncate_timeline_text")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Published var auto_translate: Bool {
|
@Published var auto_translate: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
UserDefaults.standard.set(auto_translate, forKey: "auto_translate")
|
UserDefaults.standard.set(auto_translate, forKey: "auto_translate")
|
||||||
@@ -221,6 +227,7 @@ class UserSettingsStore: ObservableObject {
|
|||||||
|
|
||||||
left_handed = UserDefaults.standard.object(forKey: "left_handed") as? Bool ?? false
|
left_handed = UserDefaults.standard.object(forKey: "left_handed") as? Bool ?? false
|
||||||
zap_vibration = UserDefaults.standard.object(forKey: "zap_vibration") as? Bool ?? false
|
zap_vibration = UserDefaults.standard.object(forKey: "zap_vibration") as? Bool ?? false
|
||||||
|
truncate_timeline_text = UserDefaults.standard.object(forKey: "truncate_timeline_text") as? Bool ?? false
|
||||||
disable_animation = should_disable_image_animation()
|
disable_animation = should_disable_image_animation()
|
||||||
auto_translate = UserDefaults.standard.object(forKey: "auto_translate") as? Bool ?? true
|
auto_translate = UserDefaults.standard.object(forKey: "auto_translate") as? Bool ?? true
|
||||||
show_only_preferred_languages = UserDefaults.standard.object(forKey: "show_only_preferred_languages") as? Bool ?? false
|
show_only_preferred_languages = UserDefaults.standard.object(forKey: "show_only_preferred_languages") as? Bool ?? false
|
||||||
|
|||||||
@@ -214,6 +214,8 @@ struct ConfigView: View {
|
|||||||
.toggleStyle(.switch)
|
.toggleStyle(.switch)
|
||||||
Toggle(NSLocalizedString("Zap Vibration", comment: "Setting to enable vibration on zap"), isOn: $settings.zap_vibration)
|
Toggle(NSLocalizedString("Zap Vibration", comment: "Setting to enable vibration on zap"), isOn: $settings.zap_vibration)
|
||||||
.toggleStyle(.switch)
|
.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.")) {
|
Section(NSLocalizedString("Images", comment: "Section title for images configuration.")) {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ struct TextEvent: View {
|
|||||||
}
|
}
|
||||||
.padding(.horizontal)
|
.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) {
|
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
||||||
Mention(mention)
|
Mention(mention)
|
||||||
@@ -149,7 +149,7 @@ struct TextEvent: View {
|
|||||||
TopPart(is_anon: is_anon)
|
TopPart(is_anon: is_anon)
|
||||||
|
|
||||||
ReplyPart
|
ReplyPart
|
||||||
EvBody(options: [])
|
EvBody(options: self.options)
|
||||||
|
|
||||||
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
if let mention = first_eref_mention(ev: event, privkey: damus.keypair.privkey) {
|
||||||
Mention(mention)
|
Mention(mention)
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ struct InnerTimelineView: View {
|
|||||||
self._nav_target = State(initialValue: test_event)
|
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 {
|
var body: some View {
|
||||||
let thread = ThreadModel(event: nav_target, damus_state: damus)
|
let thread = ThreadModel(event: nav_target, damus_state: damus)
|
||||||
let dest = ThreadView(state: damus, thread: thread)
|
let dest = ThreadView(state: damus, thread: thread)
|
||||||
@@ -37,7 +45,7 @@ struct InnerTimelineView: View {
|
|||||||
EmptyTimelineView()
|
EmptyTimelineView()
|
||||||
} else {
|
} else {
|
||||||
ForEach(events.filter(filter), id: \.id) { (ev: NostrEvent) in
|
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 {
|
.onTapGesture {
|
||||||
nav_target = ev.inner_event ?? ev
|
nav_target = ev.inner_event ?? ev
|
||||||
navigating = true
|
navigating = true
|
||||||
|
|||||||
Reference in New Issue
Block a user