// // ComposingPrefsView.swift // Tusker // // Created by Shadowfacts on 2/22/20. // Copyright © 2020 Shadowfacts. All rights reserved. // import SwiftUI import Pachyderm struct ComposingPrefsView: View { @ObservedObject var preferences = Preferences.shared var body: some View { List { visibilitySection composingSection replyingSection writingSection } .listStyle(.insetGrouped) .appGroupedScrollBackgroundIfAvailable() .navigationBarTitle("Composing") } var visibilitySection: some View { Section { Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Visibility")) { ForEach(Status.Visibility.allCases, id: \.self) { visibility in HStack { Image(systemName: visibility.imageName) Text(visibility.displayName) } .tag(visibility) }//.navigationBarTitle("Default Post Visibility") // navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291 } Picker(selection: $preferences.defaultReplyVisibility, label: Text("Reply Visibility")) { ForEach(Preferences.ReplyVisibility.allCases, id: \.self) { visibility in HStack { if let imageName = visibility.imageName { Image(systemName: imageName) } Text(visibility.displayName) } .tag(visibility) } } } header: { Text("Visibility") } footer: { Text("When starting a reply, Tusker will use your preferred visibility or the visibility of the post to which you're replying, whichever is narrower.") } .listRowBackground(Color.appGroupedCellBackground) } var composingSection: some View { Section(header: Text("Composing")) { Toggle(isOn: $preferences.automaticallySaveDrafts) { Text("Automatically Save Drafts") } Toggle(isOn: $preferences.requireAttachmentDescriptions) { Text("Require Attachment Descriptions") } } .listRowBackground(Color.appGroupedCellBackground) } var replyingSection: some View { Section(header: Text("Replying")) { Picker(selection: $preferences.contentWarningCopyMode, label: Text("Copy Content Warnings")) { Text("As-is").tag(ContentWarningCopyMode.asIs) Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe) Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy) } Toggle(isOn: $preferences.mentionReblogger) { Text("Mention Reblogger") } } .listRowBackground(Color.appGroupedCellBackground) } var writingSection: some View { Section { Toggle(isOn: $preferences.useTwitterKeyboard) { Text("Show @ and # on Keyboard") } } .listRowBackground(Color.appGroupedCellBackground) } } struct ComposingPrefsView_Previews: PreviewProvider { static var previews: some View { ComposingPrefsView() } }