64 lines
2.1 KiB
Swift
64 lines
2.1 KiB
Swift
// BehaviorPrefsView.swift
|
|
// Tusker
|
|
//
|
|
// Created by Shadowfacts on 6/13/19.
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Pachyderm
|
|
|
|
struct BehaviorPrefsView : View {
|
|
@Preference(\.defaultPostVisibility) var defaultPostVisibility: Status.Visibility
|
|
@Preference(\.automaticallySaveDrafts) var automaticallySaveDrafts: Bool
|
|
@Preference(\.contentWarningCopyMode) var contentWarningCopyMode: ContentWarningCopyMode
|
|
@Preference(\.openLinksInApps) var openLinksInApps: Bool
|
|
|
|
var body: some View {
|
|
List {
|
|
section1
|
|
section2
|
|
}.listStyle(GroupedListStyle())
|
|
.navigationBarTitle(Text("Behavior"))
|
|
}
|
|
|
|
var section1: some View {
|
|
Section {
|
|
Picker(selection: _defaultPostVisibility.binding, 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: _automaticallySaveDrafts.binding) {
|
|
Text("Automatically Save Drafts")
|
|
}
|
|
Picker(selection: _contentWarningCopyMode.binding, 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 section2: some View {
|
|
Section {
|
|
Toggle(isOn: _openLinksInApps.binding) {
|
|
Text("Open Links in Apps")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#if DEBUG
|
|
struct BehaviorPrefsView_Previews : PreviewProvider {
|
|
static var previews: some View {
|
|
BehaviorPrefsView()
|
|
}
|
|
}
|
|
#endif
|