Split Composing prefs into Composing and Replying

This commit is contained in:
Shadowfacts 2020-01-19 23:23:00 -05:00
parent 11f9642cba
commit 7934bc15ac
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 21 additions and 15 deletions

View File

@ -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

View File

@ -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")