Tusker/Tusker/Screens/Preferences/ComposingPrefsView.swift

63 lines
2.1 KiB
Swift

//
// 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 {
composingSection
replyingSection
}.listStyle(GroupedListStyle()).navigationBarTitle("Composing")
}
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
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
}
Toggle(isOn: $preferences.automaticallySaveDrafts) {
Text("Automatically Save Drafts")
}
Toggle(isOn: $preferences.requireAttachmentDescriptions) {
Text("Require Attachment Descriptions")
}
}
}
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")
}
}
}
}
struct ComposingPrefsView_Previews: PreviewProvider {
static var previews: some View {
ComposingPrefsView()
}
}