Tusker/Tusker/Screens/Preferences/WellnessPrefsView.swift

74 lines
2.3 KiB
Swift
Raw Normal View History

//
// WellnessPrefsView.swift
// Tusker
//
// Created by Shadowfacts on 9/14/19.
// Copyright © 2019 Shadowfacts. All rights reserved.
//
import SwiftUI
struct WellnessPrefsView: View {
2020-11-01 18:59:58 +00:00
@ObservedObject private var preferences = Preferences.shared
var body: some View {
List {
2020-11-01 18:59:58 +00:00
showFavAndReblogCount
notificationsMode
grayscaleImages
2022-07-01 01:41:05 +00:00
disableInfiniteScrolling
2022-04-01 23:23:49 +00:00
hideDiscover
}
2021-02-06 18:47:45 +00:00
.listStyle(InsetGroupedListStyle())
.navigationBarTitle(Text("Digital Wellness"))
}
2020-11-01 18:59:58 +00:00
private var showFavAndReblogCount: some View {
2022-12-05 00:50:15 +00:00
Section(footer: Text("Control whether the focused post in the conversation view shows total favorite and reblog counts.")) {
Toggle(isOn: $preferences.showFavoriteAndReblogCounts) {
2022-12-05 00:50:15 +00:00
Text("Favorite and Reblog Counts in Conversations")
}
}
}
2020-11-01 18:59:58 +00:00
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)
}
}
}
}
2020-11-01 18:59:58 +00:00
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")
}
}
}
2022-04-01 23:23:49 +00:00
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()
}
}