Implement additional text truncation settings
Changelog-Added: Added text truncation settings
This commit is contained in:
@@ -276,7 +276,7 @@ class UserSettingsStore: ObservableObject {
|
|||||||
dm_notification = UserDefaults.standard.object(forKey: "dm_notification") as? Bool ?? true
|
dm_notification = UserDefaults.standard.object(forKey: "dm_notification") as? Bool ?? true
|
||||||
notification_only_from_following = UserDefaults.standard.object(forKey: "notification_only_from_following") as? Bool ?? false
|
notification_only_from_following = UserDefaults.standard.object(forKey: "notification_only_from_following") as? Bool ?? false
|
||||||
truncate_timeline_text = UserDefaults.standard.object(forKey: "truncate_timeline_text") as? Bool ?? false
|
truncate_timeline_text = UserDefaults.standard.object(forKey: "truncate_timeline_text") as? Bool ?? false
|
||||||
truncate_mention_text = UserDefaults.standard.object(forKey: "truncate_mention_text") as? Bool ?? true
|
truncate_mention_text = UserDefaults.standard.object(forKey: "truncate_mention_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
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ struct EventGroupView: View {
|
|||||||
NavigationLink(destination: dest) {
|
NavigationLink(destination: dest) {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
GroupDescription
|
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([.top], 1)
|
||||||
.padding([.trailing])
|
.padding([.trailing])
|
||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
|
|||||||
@@ -35,6 +35,14 @@ struct NotificationItemView: View {
|
|||||||
notification_item_event(events: state.events, notif: item)
|
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 {
|
func Item(_ ev: NostrEvent?) -> some View {
|
||||||
Group {
|
Group {
|
||||||
switch item {
|
switch item {
|
||||||
@@ -52,7 +60,7 @@ struct NotificationItemView: View {
|
|||||||
|
|
||||||
case .reply(let ev):
|
case .reply(let ev):
|
||||||
NavigationLink(destination: ThreadView(state: state, thread: ThreadModel(event: ev, damus_state: state))) {
|
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)
|
.buttonStyle(.plain)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user