diff --git a/Tusker/Preferences/Preferences.swift b/Tusker/Preferences/Preferences.swift index 75fdaa97..12fdd88f 100644 --- a/Tusker/Preferences/Preferences.swift +++ b/Tusker/Preferences/Preferences.swift @@ -44,8 +44,8 @@ class Preferences: Codable, ObservableObject { self.defaultPostVisibility = try container.decode(Status.Visibility.self, forKey: .defaultPostVisibility) self.automaticallySaveDrafts = try container.decode(Bool.self, forKey: .automaticallySaveDrafts) - self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode) self.requireAttachmentDescriptions = try container.decode(Bool.self, forKey: .requireAttachmentDescriptions) + self.contentWarningCopyMode = try container.decode(ContentWarningCopyMode.self, forKey: .contentWarningCopyMode) self.blurAllMedia = try container.decode(Bool.self, forKey: .blurAllMedia) self.openLinksInApps = try container.decode(Bool.self, forKey: .openLinksInApps) self.useInAppSafari = try container.decode(Bool.self, forKey: .useInAppSafari) @@ -68,8 +68,8 @@ class Preferences: Codable, ObservableObject { try container.encode(defaultPostVisibility, forKey: .defaultPostVisibility) try container.encode(automaticallySaveDrafts, forKey: .automaticallySaveDrafts) - try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode) try container.encode(requireAttachmentDescriptions, forKey: .requireAttachmentDescriptions) + try container.encode(contentWarningCopyMode, forKey: .contentWarningCopyMode) try container.encode(blurAllMedia, forKey: .blurAllMedia) try container.encode(openLinksInApps, forKey: .openLinksInApps) try container.encode(useInAppSafari, forKey: .useInAppSafari) @@ -91,8 +91,8 @@ class Preferences: Codable, ObservableObject { // MARK: - Behavior @Published var defaultPostVisibility = Status.Visibility.public @Published var automaticallySaveDrafts = true - @Published var contentWarningCopyMode = ContentWarningCopyMode.asIs @Published var requireAttachmentDescriptions = false + @Published var contentWarningCopyMode = ContentWarningCopyMode.asIs @Published var blurAllMedia = false @Published var openLinksInApps = true @Published var useInAppSafari = true @@ -114,8 +114,8 @@ class Preferences: Codable, ObservableObject { case defaultPostVisibility case automaticallySaveDrafts - case contentWarningCopyMode case requireAttachmentDescriptions + case contentWarningCopyMode case blurAllMedia case openLinksInApps case useInAppSafari diff --git a/Tusker/Screens/Preferences/BehaviorPrefsView.swift b/Tusker/Screens/Preferences/BehaviorPrefsView.swift index bb07a322..540f466e 100644 --- a/Tusker/Screens/Preferences/BehaviorPrefsView.swift +++ b/Tusker/Screens/Preferences/BehaviorPrefsView.swift @@ -13,14 +13,15 @@ struct BehaviorPrefsView: View { var body: some View { List { - section1 - section2 - section3 + composingSection + replyingSection + readingSection + linksSection }.listStyle(GroupedListStyle()) .navigationBarTitle(Text("Behavior")) } - var section1: some View { + var composingSection: some View { Section(header: Text("COMPOSING")) { Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) { ForEach(Status.Visibility.allCases, id: \.self) { visibility in @@ -35,18 +36,23 @@ struct BehaviorPrefsView: View { Toggle(isOn: $preferences.automaticallySaveDrafts) { Text("Automatically Save Drafts") } - Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) { - Text("As-is").tag(ContentWarningCopyMode.asIs) - Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe) - Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy) - } Toggle(isOn: $preferences.requireAttachmentDescriptions) { Text("Require Attachment Descriptions") } } } - var section2: some View { + var replyingSection: some View { + Section(header: Text("REPLYING")) { + Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) { + Text("As-is").tag(ContentWarningCopyMode.asIs) + Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe) + Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy) + } + } + } + + var readingSection: some View { Section(header: Text("READING")) { Toggle(isOn: $preferences.blurAllMedia) { Text("Blur All Media") @@ -54,7 +60,7 @@ struct BehaviorPrefsView: View { } } - var section3: some View { + var linksSection: some View { Section(header: Text("LINKS")) { Toggle(isOn: $preferences.openLinksInApps) { Text("Open Links in Apps")