Tusker/Tusker/Screens/Preferences/AdvancedPrefsView.swift

66 lines
1.7 KiB
Swift

// AdvancedPrefsView.swift
// Tusker
//
// Created by Shadowfacts on 6/13/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import SwiftUI
import Pachyderm
struct AdvancedPrefsView : View {
@ObservedObject var preferences = Preferences.shared
var body: some View {
List {
formattingSection
automationSection
}.listStyle(GroupedListStyle())
.navigationBarTitle(Text("Advanced"))
}
var formattingFooter: some View {
Text("This option is only supported for Pleroma and Mastodon instances with formatting enabled. On all other instances, formatting symbols will remain in the unformatted plain text.").lineLimit(nil)
}
var formattingSection: some View {
Section(footer: formattingFooter) {
Picker(selection: $preferences.statusContentType, label: Text("Post Content Type")) {
ForEach(StatusContentType.allCases, id: \.self) { type in
Text(type.displayName).tag(type)
}//.navigationBarTitle("Post Content Type")
// see FB6838291
}
}
}
var automationSection: some View {
Section(header: Text("AUTOMATION")) {
NavigationLink(destination: SilentActionPrefs()) {
Text("Silent Action Permissions")
}
}
}
}
extension StatusContentType {
var displayName: String {
switch self {
case .plain:
return "Plain"
case .markdown:
return "Markdown"
case .html:
return "HTML"
}
}
}
#if DEBUG
struct AdvancedPrefsView_Previews : PreviewProvider {
static var previews: some View {
AdvancedPrefsView()
}
}
#endif