Tusker/Tusker/Screens/Preferences/AppearancePrefsView.swift

58 lines
1.7 KiB
Swift
Raw Normal View History

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 {
@ObservedObject var preferences = Preferences.shared
var theme: Binding<UIUserInterfaceStyle> = Binding(get: {
Preferences.shared.theme
}, set: {
Preferences.shared.theme = $0
NotificationCenter.default.post(name: .themePreferenceChanged, object: nil)
})
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 {
Picker(selection: theme, label: Text("Theme")) {
Text("Use System Theme").tag(UIUserInterfaceStyle.unspecified)
Text("Light").tag(UIUserInterfaceStyle.light)
Text("Dark").tag(UIUserInterfaceStyle.dark)
}
Toggle(isOn: $preferences.showRepliesInProfiles) {
2019-06-14 00:53:17 +00:00
Text("Show Replies in Profiles")
}
Toggle(isOn: useCircularAvatars) {
2019-06-14 00:53:17 +00:00
Text("Use Circular Avatars")
}
Toggle(isOn: $preferences.hideCustomEmojiInUsernames) {
2019-06-14 00:53:17 +00:00
Text("Hide Custom Emoji in Usernames")
}
2020-06-17 21:45:34 +00:00
Toggle(isOn: $preferences.showIsStatusReplyIcon) {
Text("Show Status Reply Icons")
}
2019-06-14 00:53:17 +00:00
}
2019-08-06 03:08:00 +00:00
.listStyle(GroupedListStyle())
2019-06-14 00:53:17 +00:00
.navigationBarTitle(Text("Appearance"))
}
}
#if DEBUG
struct AppearancePrefsView_Previews : PreviewProvider {
static var previews: some View {
AppearancePrefsView()
}
}
#endif