2019-06-14 00:53:17 +00:00
|
|
|
// AppearancePrefsView.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 6/13/19.
|
|
|
|
// Copyright © 2019 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct AppearancePrefsView : View {
|
2019-11-15 00:53:00 +00:00
|
|
|
@ObservedObject var preferences = Preferences.shared
|
|
|
|
|
2019-12-31 05:12:18 +00:00
|
|
|
var theme: Binding<UIUserInterfaceStyle> = Binding(get: {
|
|
|
|
Preferences.shared.theme
|
|
|
|
}, set: {
|
|
|
|
Preferences.shared.theme = $0
|
|
|
|
NotificationCenter.default.post(name: .themePreferenceChanged, object: nil)
|
|
|
|
})
|
|
|
|
|
2019-11-15 00:53:00 +00:00
|
|
|
var useCircularAvatars: Binding<Bool> = Binding(get: {
|
|
|
|
Preferences.shared.avatarStyle == .circle
|
|
|
|
}) {
|
|
|
|
Preferences.shared.avatarStyle = $0 ? .circle : .roundRect
|
|
|
|
}
|
|
|
|
|
2019-06-14 00:53:17 +00:00
|
|
|
var body: some View {
|
|
|
|
List {
|
2019-12-31 05:12:18 +00:00
|
|
|
Picker(selection: theme, label: Text("Theme")) {
|
|
|
|
Text("Use System Theme").tag(UIUserInterfaceStyle.unspecified)
|
|
|
|
Text("Light").tag(UIUserInterfaceStyle.light)
|
|
|
|
Text("Dark").tag(UIUserInterfaceStyle.dark)
|
|
|
|
}
|
2020-08-16 18:58:10 +00:00
|
|
|
accountsSection
|
|
|
|
postsSection
|
|
|
|
}
|
2021-02-06 18:47:45 +00:00
|
|
|
.listStyle(InsetGroupedListStyle())
|
2020-09-16 00:46:49 +00:00
|
|
|
.navigationBarTitle(Text("Appearance"))
|
2020-08-16 18:58:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private var accountsSection: some View {
|
|
|
|
Section(header: Text("Accounts")) {
|
2019-11-15 00:53:00 +00:00
|
|
|
Toggle(isOn: useCircularAvatars) {
|
2019-06-14 00:53:17 +00:00
|
|
|
Text("Use Circular Avatars")
|
|
|
|
}
|
2019-11-15 00:53:00 +00:00
|
|
|
Toggle(isOn: $preferences.hideCustomEmojiInUsernames) {
|
2019-06-14 00:53:17 +00:00
|
|
|
Text("Hide Custom Emoji in Usernames")
|
|
|
|
}
|
2020-08-16 18:58:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private var postsSection: some View {
|
|
|
|
Section(header: Text("Posts")) {
|
2020-06-17 21:45:34 +00:00
|
|
|
Toggle(isOn: $preferences.showIsStatusReplyIcon) {
|
|
|
|
Text("Show Status Reply Icons")
|
|
|
|
}
|
2020-06-17 22:00:13 +00:00
|
|
|
Toggle(isOn: $preferences.alwaysShowStatusVisibilityIcon) {
|
|
|
|
Text("Always Show Status Visibility Icons")
|
|
|
|
}
|
2019-06-14 00:53:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
struct AppearancePrefsView_Previews : PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
AppearancePrefsView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|