Tusker/Tusker/Screens/Preferences/WellnessPrefsView.swift

74 lines
2.3 KiB
Swift

//
// WellnessPrefsView.swift
// Tusker
//
// Created by Shadowfacts on 9/14/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import SwiftUI
struct WellnessPrefsView: View {
@ObservedObject private var preferences = Preferences.shared
var body: some View {
List {
showFavAndReblogCount
notificationsMode
grayscaleImages
disableInfiniteScrolling
hideDiscover
}
.listStyle(InsetGroupedListStyle())
.navigationBarTitle(Text("Digital Wellness"))
}
private var showFavAndReblogCount: some View {
Section(footer: Text("Control whether the focused post in the conversation view shows total favorite and reblog counts.")) {
Toggle(isOn: $preferences.showFavoriteAndReblogCounts) {
Text("Favorite and Reblog Counts in Conversations")
}
}
}
private var notificationsMode: some View {
Section(footer: Text("Choose which kinds of notifications will be shown by default in the Notifications tab.")) {
Picker(selection: $preferences.defaultNotificationsMode, label: Text("Default Notifications Mode")) {
ForEach(NotificationsMode.allCases, id: \.self) { type in
Text(type.displayName).tag(type)
}
}
}
}
private var grayscaleImages: some View {
Section(footer: Text("Show attachments, avatars, headers, and custom emoji in black and white.")) {
Toggle(isOn: $preferences.grayscaleImages) {
Text("Grayscale Images")
}
}
}
private var disableInfiniteScrolling: some View {
Section(footer: Text("Require a button tap before loading more posts.")) {
Toggle(isOn: $preferences.disableInfiniteScrolling) {
Text("Disable Infinite Scrolling")
}
}
}
private var hideDiscover: some View {
Section(footer: Text("Do not show the Discover section (Trends, Profile Directory) of the Explore screen or sidebar.")) {
Toggle(isOn: $preferences.hideDiscover) {
Text("Hide Discover Section")
}
}
}
}
struct WellnessPrefsView_Previews: PreviewProvider {
static var previews: some View {
WellnessPrefsView()
}
}