From 1a8e84f5fa0bc9a388d37720266ece69eb875258 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 22 Feb 2020 13:19:31 -0500 Subject: [PATCH] Reorganize behavior preferences --- Tusker.xcodeproj/project.pbxproj | 8 +++ .../Preferences/BehaviorPrefsView.swift | 53 +--------------- .../Preferences/ComposingPrefsView.swift | 62 +++++++++++++++++++ .../Screens/Preferences/MediaPrefsView.swift | 36 +++++++++++ .../Screens/Preferences/PreferencesView.swift | 6 ++ 5 files changed, 114 insertions(+), 51 deletions(-) create mode 100644 Tusker/Screens/Preferences/ComposingPrefsView.swift create mode 100644 Tusker/Screens/Preferences/MediaPrefsView.swift diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index e08e42be7b..c965bbcb07 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -156,6 +156,8 @@ D67C57AF21E28EAD00C3118B /* Array+Uniques.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */; }; D67C57B221E28FAD00C3118B /* ComposeStatusReplyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */; }; D67C57B421E2910700C3118B /* ComposeStatusReplyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */; }; + D68015402401A6BA00D6103B /* ComposingPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D680153F2401A6BA00D6103B /* ComposingPrefsView.swift */; }; + D68015422401A74600D6103B /* MediaPrefsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68015412401A74600D6103B /* MediaPrefsView.swift */; }; D68FEC4F232C5BC300C84F23 /* SegmentedPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */; }; D693DE5723FE1A6A0061E07D /* EnhancedNavigationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */; }; D693DE5923FE24310061E07D /* InteractivePushTransition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D693DE5823FE24300061E07D /* InteractivePushTransition.swift */; }; @@ -433,6 +435,8 @@ D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Array+Uniques.swift"; sourceTree = ""; }; D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeStatusReplyView.xib; sourceTree = ""; }; D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusReplyView.swift; sourceTree = ""; }; + D680153F2401A6BA00D6103B /* ComposingPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposingPrefsView.swift; sourceTree = ""; }; + D68015412401A74600D6103B /* MediaPrefsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaPrefsView.swift; sourceTree = ""; }; D68FEC4E232C5BC300C84F23 /* SegmentedPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentedPageViewController.swift; sourceTree = ""; }; D693DE5623FE1A6A0061E07D /* EnhancedNavigationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnhancedNavigationViewController.swift; sourceTree = ""; }; D693DE5823FE24300061E07D /* InteractivePushTransition.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InteractivePushTransition.swift; sourceTree = ""; }; @@ -882,6 +886,8 @@ 04586B4022B2FFB10021BD04 /* PreferencesView.swift */, 04586B4222B301470021BD04 /* AppearancePrefsView.swift */, 0427033722B30F5F000D31B6 /* BehaviorPrefsView.swift */, + D680153F2401A6BA00D6103B /* ComposingPrefsView.swift */, + D68015412401A74600D6103B /* MediaPrefsView.swift */, D6BC9DB2232D4C07002CA326 /* WellnessPrefsView.swift */, 0427033922B31269000D31B6 /* AdvancedPrefsView.swift */, 0427037B22B316B9000D31B6 /* SilentActionPrefs.swift */, @@ -1688,6 +1694,7 @@ 04586B4122B2FFB10021BD04 /* PreferencesView.swift in Sources */, D620483223D2A6A3008A63EF /* CompositionState.swift in Sources */, D6BC9DB5232D4CE3002CA326 /* NotificationsMode.swift in Sources */, + D68015402401A6BA00D6103B /* ComposingPrefsView.swift in Sources */, D667E5EB21349EF80057A976 /* ProfileHeaderTableViewCell.swift in Sources */, 04D14BB022B34A2800642648 /* GalleryViewController.swift in Sources */, D641C773213CAA25004B4513 /* NotificationsTableViewController.swift in Sources */, @@ -1698,6 +1705,7 @@ D6AEBB3E2321638100E5038B /* UIActivity+Types.swift in Sources */, D61AC1D5232E9FA600C54D2D /* InstanceSelectorTableViewController.swift in Sources */, D626493F23C101C500612E6E /* AlbumAssetCollectionViewController.swift in Sources */, + D68015422401A74600D6103B /* MediaPrefsView.swift in Sources */, D6757A7E2157E02600721E32 /* XCBRequestSpec.swift in Sources */, D667E5F12134D5050057A976 /* UIViewController+Delegates.swift in Sources */, D6BC8748219738E1006163F1 /* EnhancedTableViewController.swift in Sources */, diff --git a/Tusker/Screens/Preferences/BehaviorPrefsView.swift b/Tusker/Screens/Preferences/BehaviorPrefsView.swift index d0120a2d4e..7d73b18c7c 100644 --- a/Tusker/Screens/Preferences/BehaviorPrefsView.swift +++ b/Tusker/Screens/Preferences/BehaviorPrefsView.swift @@ -13,59 +13,10 @@ struct BehaviorPrefsView: View { var body: some View { List { - composingSection - replyingSection - readingSection linksSection - }.listStyle(GroupedListStyle()) - .navigationBarTitle(Text("Behavior")) + }.listStyle(GroupedListStyle()).navigationBarTitle(Text("Behavior")) } - - var composingSection: some View { - Section(header: Text("COMPOSING")) { - Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) { - ForEach(Status.Visibility.allCases, id: \.self) { visibility in - HStack { - Image(systemName: visibility.imageName) - Text(visibility.displayName) - } - .tag(visibility) - }//.navigationBarTitle("Default Post Visibility") - // navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291 - } - Toggle(isOn: $preferences.automaticallySaveDrafts) { - Text("Automatically Save Drafts") - } - Toggle(isOn: $preferences.requireAttachmentDescriptions) { - Text("Require Attachment Descriptions") - } - } - } - - var replyingSection: some View { - Section(header: Text("REPLYING")) { - Picker(selection: $preferences.contentWarningCopyMode, label: Text("Content Warning Copy Style")) { - 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") - } - } - } - - var readingSection: some View { - Section(header: Text("READING")) { - Toggle(isOn: $preferences.blurAllMedia) { - Text("Blur All Media") - } - Toggle(isOn: $preferences.automaticallyPlayGifs) { - Text("Automatically Play GIFs") - } - } - } - + var linksSection: some View { Section(header: Text("LINKS")) { Toggle(isOn: $preferences.openLinksInApps) { diff --git a/Tusker/Screens/Preferences/ComposingPrefsView.swift b/Tusker/Screens/Preferences/ComposingPrefsView.swift new file mode 100644 index 0000000000..b00b64d90c --- /dev/null +++ b/Tusker/Screens/Preferences/ComposingPrefsView.swift @@ -0,0 +1,62 @@ +// +// ComposingPrefsView.swift +// Tusker +// +// Created by Shadowfacts on 2/22/20. +// Copyright © 2020 Shadowfacts. All rights reserved. +// + +import SwiftUI +import Pachyderm + +struct ComposingPrefsView: View { + @ObservedObject var preferences = Preferences.shared + + var body: some View { + List { + composingSection + replyingSection + }.listStyle(GroupedListStyle()).navigationBarTitle("Composing") + } + + var composingSection: some View { + Section(header: Text("COMPOSING")) { + Picker(selection: $preferences.defaultPostVisibility, label: Text("Default Post Visibility")) { + ForEach(Status.Visibility.allCases, id: \.self) { visibility in + HStack { + Image(systemName: visibility.imageName) + Text(visibility.displayName) + } + .tag(visibility) + }//.navigationBarTitle("Default Post Visibility") + // navbar title on the ForEach is currently incorrectly applied when the picker is not expanded, see FB6838291 + } + Toggle(isOn: $preferences.automaticallySaveDrafts) { + Text("Automatically Save Drafts") + } + Toggle(isOn: $preferences.requireAttachmentDescriptions) { + Text("Require Attachment Descriptions") + } + } + } + + var replyingSection: some View { + Section(header: Text("REPLYING")) { + 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") + } + } + } + +} + +struct ComposingPrefsView_Previews: PreviewProvider { + static var previews: some View { + ComposingPrefsView() + } +} diff --git a/Tusker/Screens/Preferences/MediaPrefsView.swift b/Tusker/Screens/Preferences/MediaPrefsView.swift new file mode 100644 index 0000000000..9284022c4d --- /dev/null +++ b/Tusker/Screens/Preferences/MediaPrefsView.swift @@ -0,0 +1,36 @@ +// +// MediaPrefsView.swift +// Tusker +// +// Created by Shadowfacts on 2/22/20. +// Copyright © 2020 Shadowfacts. All rights reserved. +// + +import SwiftUI + +struct MediaPrefsView: View { + @ObservedObject var preferences = Preferences.shared + + var body: some View { + List { + viewingSection + }.listStyle(GroupedListStyle()).navigationBarTitle("Media") + } + + var viewingSection: some View { + Section(header: Text("VIEWING")) { + Toggle(isOn: $preferences.blurAllMedia) { + Text("Blur All Media") + } + Toggle(isOn: $preferences.automaticallyPlayGifs) { + Text("Automatically Play GIFs") + } + } + } +} + +struct MediaPrefsView_Previews: PreviewProvider { + static var previews: some View { + MediaPrefsView() + } +} diff --git a/Tusker/Screens/Preferences/PreferencesView.swift b/Tusker/Screens/Preferences/PreferencesView.swift index b30daa523b..86896dc830 100644 --- a/Tusker/Screens/Preferences/PreferencesView.swift +++ b/Tusker/Screens/Preferences/PreferencesView.swift @@ -52,6 +52,12 @@ struct PreferencesView: View { NavigationLink(destination: AppearancePrefsView()) { Text("Appearance") } + NavigationLink(destination: ComposingPrefsView()) { + Text("Composing") + } + NavigationLink(destination: MediaPrefsView()) { + Text("Media") + } NavigationLink(destination: BehaviorPrefsView()) { Text("Behavior") }