From d94535cc14d18d4ea2ac19e98c60d3fe485dd204 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 25 Oct 2018 21:29:13 -0400 Subject: [PATCH] Add Behavior preferences section --- Tusker.xcodeproj/project.pbxproj | 4 + .../BehaviorTableViewController.swift | 32 ++++ .../Preferences/Preferences.storyboard | 161 +++++++++++------- .../PreferencesTableViewController.swift | 20 --- 4 files changed, 135 insertions(+), 82 deletions(-) create mode 100644 Tusker/Screens/Preferences/BehaviorTableViewController.swift diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index 808d72ee..b6d5f357 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -66,6 +66,7 @@ D627FF7B217E951500CC0648 /* DraftsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF7A217E951500CC0648 /* DraftsTableViewController.swift */; }; D627FF7D217E958900CC0648 /* DraftTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D627FF7C217E958900CC0648 /* DraftTableViewCell.xib */; }; D627FF7F217E95E000CC0648 /* DraftTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF7E217E95E000CC0648 /* DraftTableViewCell.swift */; }; + D627FF81217FE8F400CC0648 /* BehaviorTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF80217FE8F400CC0648 /* BehaviorTableViewController.swift */; }; D6289E84217B795D0003D1D7 /* LargeImageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6289E83217B795D0003D1D7 /* LargeImageViewController.xib */; }; D62D2422217AA7E1005076CC /* UserActivityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62D2421217AA7E1005076CC /* UserActivityManager.swift */; }; D62D2424217ABF3F005076CC /* NSUserActivity+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D62D2423217ABF3F005076CC /* NSUserActivity+Extensions.swift */; }; @@ -259,6 +260,7 @@ D627FF7A217E951500CC0648 /* DraftsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsTableViewController.swift; sourceTree = ""; }; D627FF7C217E958900CC0648 /* DraftTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DraftTableViewCell.xib; sourceTree = ""; }; D627FF7E217E95E000CC0648 /* DraftTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftTableViewCell.swift; sourceTree = ""; }; + D627FF80217FE8F400CC0648 /* BehaviorTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorTableViewController.swift; sourceTree = ""; }; D6289E83217B795D0003D1D7 /* LargeImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LargeImageViewController.xib; sourceTree = ""; }; D62D2421217AA7E1005076CC /* UserActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityManager.swift; sourceTree = ""; }; D62D2423217ABF3F005076CC /* NSUserActivity+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSUserActivity+Extensions.swift"; sourceTree = ""; }; @@ -605,6 +607,7 @@ D663626721360E2C00C9CBA2 /* PreferencesTableViewController.swift */, D67E0512216438A7000E0927 /* AppearanceTableViewController.swift */, D621544721682A9D0003D87D /* TabsTableViewController.swift */, + D627FF80217FE8F400CC0648 /* BehaviorTableViewController.swift */, D641C78E213DF2AA004B4513 /* VisibilityTableViewController.swift */, D6C693C92161253F007D6A6D /* SilentActionPermissionsTableViewController.swift */, ); @@ -1134,6 +1137,7 @@ D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */, D62D2426217ABF63005076CC /* UserActivityType.swift in Sources */, D66362712136338600C9CBA2 /* ComposeViewController.swift in Sources */, + D627FF81217FE8F400CC0648 /* BehaviorTableViewController.swift in Sources */, D6028B9B2150811100F223B9 /* MastodonCache.swift in Sources */, D67E051521643C77000E0927 /* Tab.swift in Sources */, D62D2422217AA7E1005076CC /* UserActivityManager.swift in Sources */, diff --git a/Tusker/Screens/Preferences/BehaviorTableViewController.swift b/Tusker/Screens/Preferences/BehaviorTableViewController.swift new file mode 100644 index 00000000..13e228ce --- /dev/null +++ b/Tusker/Screens/Preferences/BehaviorTableViewController.swift @@ -0,0 +1,32 @@ +// +// BehaviorTableViewController.swift +// Tusker +// +// Created by Shadowfacts on 10/23/18. +// Copyright © 2018 Shadowfacts. All rights reserved. +// + +import UIKit + +class BehaviorTableViewController: UITableViewController { + + @IBOutlet weak var defaultPostVisibilityLabel: UILabel! + @IBOutlet weak var automaticallySaveDraftsSwitch: UISwitch! + + override func viewDidLoad() { + super.viewDidLoad() + + automaticallySaveDraftsSwitch.setOn(Preferences.shared.automaticallySaveDrafts, animated: false) + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + + defaultPostVisibilityLabel.text = Preferences.shared.defaultPostVisibility.displayName + } + + @IBAction func automaticallySaveDraftsChanged(_ sender: Any) { + Preferences.shared.automaticallySaveDrafts = automaticallySaveDraftsSwitch.isOn + } + +} diff --git a/Tusker/Screens/Preferences/Preferences.storyboard b/Tusker/Screens/Preferences/Preferences.storyboard index 51a1082b..7aeced17 100644 --- a/Tusker/Screens/Preferences/Preferences.storyboard +++ b/Tusker/Screens/Preferences/Preferences.storyboard @@ -42,75 +42,28 @@ - - - - - - + + - + - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -141,14 +94,10 @@ - - - - - + @@ -292,6 +241,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -309,7 +346,7 @@ - + @@ -348,7 +385,7 @@ - + diff --git a/Tusker/Screens/Preferences/PreferencesTableViewController.swift b/Tusker/Screens/Preferences/PreferencesTableViewController.swift index 5b1f8d85..319730a9 100644 --- a/Tusker/Screens/Preferences/PreferencesTableViewController.swift +++ b/Tusker/Screens/Preferences/PreferencesTableViewController.swift @@ -15,24 +15,4 @@ class PreferencesTableViewController: UITableViewController { return navigationController } - - @IBOutlet weak var defaultPostVisibilityLabel: UILabel! - @IBOutlet weak var automaticallySaveDraftsSwitch: UISwitch! - - override func viewDidLoad() { - super.viewDidLoad() - - automaticallySaveDraftsSwitch.setOn(Preferences.shared.automaticallySaveDrafts, animated: false) - } - - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - defaultPostVisibilityLabel.text = Preferences.shared.defaultPostVisibility.displayName - } - - @IBAction func automaticallySaveDraftsChanged(_ sender: Any) { - Preferences.shared.automaticallySaveDrafts = automaticallySaveDraftsSwitch.isOn - } - }