2019-06-14 00:53:17 +00:00
|
|
|
// BehaviorPrefsView.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 6/13/19.
|
|
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import Pachyderm
|
|
|
|
|
2019-11-15 00:53:00 +00:00
|
|
|
struct BehaviorPrefsView: View {
|
|
|
|
@ObservedObject var preferences = Preferences.shared
|
|
|
|
|
2019-06-14 00:53:17 +00:00
|
|
|
var body: some View {
|
|
|
|
List {
|
2019-07-28 01:43:08 +00:00
|
|
|
section1
|
|
|
|
section2
|
2019-11-17 17:52:42 +00:00
|
|
|
section3
|
2019-08-06 03:08:00 +00:00
|
|
|
}.listStyle(GroupedListStyle())
|
2019-07-28 01:43:08 +00:00
|
|
|
.navigationBarTitle(Text("Behavior"))
|
|
|
|
}
|
|
|
|
|
|
|
|
var section1: some View {
|
2019-09-14 17:02:33 +00:00
|
|
|
Section(header: Text("COMPOSING")) {
|
2019-11-15 00:53:00 +00:00
|
|
|
Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) {
|
2019-07-28 01:43:08 +00:00
|
|
|
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
|
2019-06-14 00:53:17 +00:00
|
|
|
}
|
2019-11-15 00:53:00 +00:00
|
|
|
Toggle(isOn: $preferences.automaticallySaveDrafts) {
|
2019-07-28 01:43:08 +00:00
|
|
|
Text("Automatically Save Drafts")
|
|
|
|
}
|
2019-11-15 00:53:00 +00:00
|
|
|
Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) {
|
2019-08-01 03:25:44 +00:00
|
|
|
Text("As-is").tag(ContentWarningCopyMode.asIs)
|
|
|
|
Text("Prepend 're: '").tag(ContentWarningCopyMode.prependRe)
|
|
|
|
Text("Don't copy").tag(ContentWarningCopyMode.doNotCopy)
|
|
|
|
}
|
2019-07-28 01:43:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var section2: some View {
|
2019-09-14 17:02:33 +00:00
|
|
|
Section(header: Text("READING")) {
|
2019-11-17 17:52:42 +00:00
|
|
|
Toggle(isOn: $preferences.blurAllMedia) {
|
|
|
|
Text("Blur All Media")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var section3: some View {
|
|
|
|
Section(header: Text("LINKS")) {
|
2019-11-15 00:53:00 +00:00
|
|
|
Toggle(isOn: $preferences.openLinksInApps) {
|
2019-07-28 01:43:08 +00:00
|
|
|
Text("Open Links in Apps")
|
2019-06-14 00:53:17 +00:00
|
|
|
}
|
2019-11-15 00:53:27 +00:00
|
|
|
Toggle(isOn: $preferences.useInAppSafari) {
|
|
|
|
Text("Use In-App Safari")
|
|
|
|
}
|
|
|
|
Toggle(isOn: $preferences.inAppSafariAutomaticReaderMode) {
|
|
|
|
Text("Always Use Reader Mode in In-App Safari")
|
|
|
|
}.disabled(!preferences.useInAppSafari)
|
2019-06-14 00:53:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
struct BehaviorPrefsView_Previews : PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
BehaviorPrefsView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|