Tusker/Tusker/Screens/Preferences/WellnessPrefsView.swift

55 lines
1.6 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 {
@ObservedObject var preferences = Preferences.shared
var body: some View {
List {
showFavAndReblogCountSection
notificationsModeSection
}
.insetOrGroupedListStyle()
.navigationBarTitle(Text("Digital Wellness"))
}
var showFavAndReblogCountSection: some View {
Section(footer: showFavAndReblogCountFooter) {
Toggle(isOn: $preferences.showFavoriteAndReblogCounts) {
Text("Show Favorite and Reblog Counts")
}
}
}
var showFavAndReblogCountFooter: some View {
Text("Control whether total favorite and reblog counts are shown for the main post in conversations.")
}
var notificationsModeSection: some View {
Section(footer: notificationsModeFooter) {
Picker(selection: $preferences.defaultNotificationsMode, label: Text("Default Notifications Mode")) {
ForEach(NotificationsMode.allCases, id: \.self) { type in
Text(type.displayName).tag(type)
}
}
}
}
var notificationsModeFooter: some View {
Text("Choose which kinds of notifications will be shown by default in the Notifications tab.")
}
}
struct WellnessPrefsView_Previews: PreviewProvider {
static var previews: some View {
WellnessPrefsView()
}
}