Tusker/Tusker/Screens/Preferences/WellnessPrefsView.swift

81 lines
2.6 KiB
Swift

//
// WellnessPrefsView.swift
// Tusker
//
// Created by Shadowfacts on 9/14/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import SwiftUI
import TuskerPreferences
struct WellnessPrefsView: View {
@ObservedObject private var preferences = Preferences.shared
var body: some View {
List {
showFavAndReblogCount
notificationsMode
grayscaleImages
disableInfiniteScrolling
hideTrends
}
.listStyle(.insetGrouped)
.appGroupedListBackground(container: PreferencesNavigationController.self)
.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")
}
}
.appGroupedListRowBackground()
}
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)
}
}
}
.appGroupedListRowBackground()
}
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")
}
}
.appGroupedListRowBackground()
}
private var disableInfiniteScrolling: some View {
Section(footer: Text("Require a button tap before loading more posts.")) {
Toggle(isOn: $preferences.disableInfiniteScrolling) {
Text("Disable Infinite Scrolling")
}
}
.appGroupedListRowBackground()
}
private var hideTrends: some View {
Section(footer: Text("Do not show Trends (hashtags, links, posts, suggested accounts) on the Explore screen.")) {
Toggle(isOn: $preferences.hideTrends) {
Text("Hide Trends")
}
}
.appGroupedListRowBackground()
}
}
struct WellnessPrefsView_Previews: PreviewProvider {
static var previews: some View {
WellnessPrefsView()
}
}