2020-02-22 18:19:31 +00:00
//
// C o m p o s i n g P r e f s V i e w . s w i f t
// T u s k e r
//
// C r e a t e d b y S h a d o w f a c t s o n 2 / 2 2 / 2 0 .
// C o p y r i g h t © 2 0 2 0 S h a d o w f a c t s . A l l r i g h t s r e s e r v e d .
//
import SwiftUI
import Pachyderm
struct ComposingPrefsView : View {
@ ObservedObject var preferences = Preferences . shared
var body : some View {
List {
2022-11-05 16:20:30 +00:00
visibilitySection
2020-02-22 18:19:31 +00:00
composingSection
replyingSection
2022-11-22 16:06:21 +00:00
writingSection
2020-09-16 00:46:49 +00:00
}
2023-02-03 04:29:44 +00:00
. listStyle ( . insetGrouped )
2023-02-06 23:42:55 +00:00
. appGroupedListBackground ( container : PreferencesNavigationController . self )
2020-09-16 00:46:49 +00:00
. navigationBarTitle ( " Composing " )
2020-02-22 18:19:31 +00:00
}
2022-11-05 16:20:30 +00:00
var visibilitySection : some View {
Section {
Picker ( selection : $ preferences . defaultPostVisibility , label : Text ( " Default Visibility " ) ) {
2023-03-07 15:14:35 +00:00
ForEach ( Visibility . allCases , id : \ . self ) { visibility in
2020-02-22 18:19:31 +00:00
HStack {
Image ( systemName : visibility . imageName )
Text ( visibility . displayName )
}
. tag ( visibility )
} // . n a v i g a t i o n B a r T i t l e ( " D e f a u l t P o s t V i s i b i l i t y " )
// n a v b a r t i t l e o n t h e F o r E a c h i s c u r r e n t l y i n c o r r e c t l y a p p l i e d w h e n t h e p i c k e r i s n o t e x p a n d e d , s e e F B 6 8 3 8 2 9 1
}
2022-11-05 16:20:30 +00:00
Picker ( selection : $ preferences . defaultReplyVisibility , label : Text ( " Reply Visibility " ) ) {
ForEach ( Preferences . ReplyVisibility . allCases , id : \ . self ) { visibility in
HStack {
if let imageName = visibility . imageName {
Image ( systemName : imageName )
}
Text ( visibility . displayName )
}
. tag ( visibility )
}
}
} header : {
Text ( " Visibility " )
} footer : {
Text ( " When starting a reply, Tusker will use your preferred visibility or the visibility of the post to which you're replying, whichever is narrower. " )
}
2023-02-06 23:42:55 +00:00
. appGroupedListRowBackground ( )
2022-11-05 16:20:30 +00:00
}
var composingSection : some View {
Section ( header : Text ( " Composing " ) ) {
2020-02-22 18:19:31 +00:00
Toggle ( isOn : $ preferences . automaticallySaveDrafts ) {
Text ( " Automatically Save Drafts " )
}
Toggle ( isOn : $ preferences . requireAttachmentDescriptions ) {
Text ( " Require Attachment Descriptions " )
}
}
2023-02-06 23:42:55 +00:00
. appGroupedListRowBackground ( )
2020-02-22 18:19:31 +00:00
}
var replyingSection : some View {
2020-08-16 18:58:02 +00:00
Section ( header : Text ( " Replying " ) ) {
2020-02-22 18:19:31 +00:00
Picker ( selection : $ preferences . contentWarningCopyMode , label : Text ( " Copy Content Warnings " ) ) {
Text ( " As-is " ) . tag ( ContentWarningCopyMode . asIs )
Text ( " Prepend 're: ' " ) . tag ( ContentWarningCopyMode . prependRe )
Text ( " Don't copy " ) . tag ( ContentWarningCopyMode . doNotCopy )
}
Toggle ( isOn : $ preferences . mentionReblogger ) {
Text ( " Mention Reblogger " )
}
}
2023-02-06 23:42:55 +00:00
. appGroupedListRowBackground ( )
2020-02-22 18:19:31 +00:00
}
2022-11-22 16:06:21 +00:00
var writingSection : some View {
Section {
Toggle ( isOn : $ preferences . useTwitterKeyboard ) {
Text ( " Show @ and # on Keyboard " )
}
}
2023-02-06 23:42:55 +00:00
. appGroupedListRowBackground ( )
2022-11-22 16:06:21 +00:00
}
2020-02-22 18:19:31 +00:00
}
struct ComposingPrefsView_Previews : PreviewProvider {
static var previews : some View {
ComposingPrefsView ( )
}
}