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
|
|
|
|
|
|
|
|
struct BehaviorPrefsView : View {
|
|
|
|
@Preference(\.defaultPostVisibility) var defaultPostVisibility: Status.Visibility
|
|
|
|
@Preference(\.automaticallySaveDrafts) var automaticallySaveDrafts: Bool
|
|
|
|
@Preference(\.openLinksInApps) var openLinksInApps: Bool
|
|
|
|
|
|
|
|
var body: some View {
|
|
|
|
List {
|
|
|
|
Section {
|
2019-07-18 22:44:35 +00:00
|
|
|
Picker(selection: _defaultPostVisibility.binding, label: Text("Default Post Visibility")) {
|
|
|
|
ForEach(Status.Visibility.allCases, id: \.self) { visibility in
|
2019-06-14 00:53:17 +00:00
|
|
|
HStack {
|
|
|
|
Image(systemName: visibility.imageName)
|
|
|
|
Text(visibility.displayName)
|
|
|
|
}
|
|
|
|
.tag(visibility)
|
2019-07-28 01:34:20 +00:00
|
|
|
}//.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-07-18 22:44:35 +00:00
|
|
|
Toggle(isOn: _automaticallySaveDrafts.binding) {
|
2019-06-14 00:53:17 +00:00
|
|
|
Text("Automatically Save Drafts")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Section {
|
2019-07-18 22:44:35 +00:00
|
|
|
Toggle(isOn: _openLinksInApps.binding) {
|
2019-06-14 00:53:17 +00:00
|
|
|
Text("Open Links in Apps")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.listStyle(.grouped)
|
|
|
|
.navigationBarTitle(Text("Behavior"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
struct BehaviorPrefsView_Previews : PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
BehaviorPrefsView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|