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 {
|
2021-04-05 21:48:03 +00:00
|
|
|
untitledSection
|
2020-01-20 04:23:00 +00:00
|
|
|
linksSection
|
2020-09-16 01:37:08 +00:00
|
|
|
contentWarningsSection
|
2020-09-16 00:46:49 +00:00
|
|
|
}
|
2021-02-06 18:47:45 +00:00
|
|
|
.listStyle(InsetGroupedListStyle())
|
2020-09-16 00:46:49 +00:00
|
|
|
.navigationBarTitle(Text("Behavior"))
|
2019-07-28 01:43:08 +00:00
|
|
|
}
|
2021-04-05 21:48:03 +00:00
|
|
|
|
|
|
|
private var untitledSection: some View {
|
|
|
|
Section {
|
|
|
|
Toggle(isOn: $preferences.confirmBeforeReblog) {
|
|
|
|
Text("Require Confirmation Before Reblogging")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-02-22 18:19:31 +00:00
|
|
|
|
2021-04-05 21:48:03 +00:00
|
|
|
private var linksSection: some View {
|
2020-08-16 18:58:02 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|
2020-09-16 01:37:08 +00:00
|
|
|
|
2021-04-05 21:48:03 +00:00
|
|
|
private var contentWarningsSection: some View {
|
2020-09-16 01:37:08 +00:00
|
|
|
Section(header: Text("Content Warnings")) {
|
2020-11-03 20:39:02 +00:00
|
|
|
Toggle(isOn: $preferences.collapseLongPosts) {
|
|
|
|
Text("Collapse Long Posts")
|
|
|
|
}
|
|
|
|
|
2020-09-16 01:37:08 +00:00
|
|
|
Toggle(isOn: $preferences.expandAllContentWarnings) {
|
|
|
|
Text("Expand All Content Warnings")
|
|
|
|
}
|
|
|
|
|
2020-11-03 20:39:02 +00:00
|
|
|
NavigationLink(destination: OppositeCollapseKeywordsView()) {
|
|
|
|
Text(preferences.expandAllContentWarnings ? "Collapse Posts with Keywords in CWs" : "Expand Posts with Keywords in CWs")
|
2020-09-16 01:37:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-06-14 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
struct BehaviorPrefsView_Previews : PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
BehaviorPrefsView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|