// // 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(.insetGrouped) .appGroupedScrollBackgroundIfAvailable() .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") } } .listRowBackground(Color.appGroupedCellBackground) } 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) } } } .listRowBackground(Color.appGroupedCellBackground) } 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") } } .listRowBackground(Color.appGroupedCellBackground) } private var disableInfiniteScrolling: some View { Section(footer: Text("Require a button tap before loading more posts.")) { Toggle(isOn: $preferences.disableInfiniteScrolling) { Text("Disable Infinite Scrolling") } } .listRowBackground(Color.appGroupedCellBackground) } 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") } } .listRowBackground(Color.appGroupedCellBackground) } } struct WellnessPrefsView_Previews: PreviewProvider { static var previews: some View { WellnessPrefsView() } }