Add Behavior preferences section

This commit is contained in:
Shadowfacts 2018-10-25 21:29:13 -04:00
parent df6976df2f
commit ba55540712
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 135 additions and 82 deletions

View File

@ -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 = "<group>"; };
D627FF7C217E958900CC0648 /* DraftTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DraftTableViewCell.xib; sourceTree = "<group>"; };
D627FF7E217E95E000CC0648 /* DraftTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftTableViewCell.swift; sourceTree = "<group>"; };
D627FF80217FE8F400CC0648 /* BehaviorTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BehaviorTableViewController.swift; sourceTree = "<group>"; };
D6289E83217B795D0003D1D7 /* LargeImageViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LargeImageViewController.xib; sourceTree = "<group>"; };
D62D2421217AA7E1005076CC /* UserActivityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserActivityManager.swift; sourceTree = "<group>"; };
D62D2423217ABF3F005076CC /* NSUserActivity+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSUserActivity+Extensions.swift"; sourceTree = "<group>"; };
@ -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 */,

View File

@ -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
}
}

View File

@ -42,75 +42,28 @@
<segue destination="oM9-mi-wRc" kind="show" id="G45-fS-Nsj"/>
</connections>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection headerTitle="Behavior" id="QnL-PI-wDE">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="RwH-Ti-TH8">
<rect key="frame" x="0.0" y="135" width="375" height="44"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="58g-Zq-ZuE">
<rect key="frame" x="0.0" y="79" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="RwH-Ti-TH8" id="NJF-ED-5cF">
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="58g-Zq-ZuE" id="4bV-t8-TdS">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Default Post Visibility" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iEj-dZ-E4F">
<rect key="frame" x="16" y="11.5" width="162" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Behavior" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8XT-eR-Gzo">
<rect key="frame" x="16" y="11" width="67" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Public" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="se3-JR-wRN">
<rect key="frame" x="294" y="11.5" width="47" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="se3-JR-wRN" firstAttribute="centerY" secondItem="NJF-ED-5cF" secondAttribute="centerY" id="GGU-6Y-NSR"/>
<constraint firstItem="iEj-dZ-E4F" firstAttribute="leading" secondItem="NJF-ED-5cF" secondAttribute="leadingMargin" id="X5l-TE-I3w"/>
<constraint firstAttribute="trailing" secondItem="se3-JR-wRN" secondAttribute="trailing" id="eeH-Zb-ZS9"/>
<constraint firstItem="iEj-dZ-E4F" firstAttribute="centerY" secondItem="NJF-ED-5cF" secondAttribute="centerY" id="rak-B9-rwy"/>
</constraints>
</tableViewCellContentView>
<connections>
<segue destination="50Z-Q7-qIn" kind="show" id="uHj-Vc-3uZ"/>
<segue destination="Nk9-yO-78a" kind="show" id="PFV-VR-Ujc"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="FPb-UJ-alk">
<rect key="frame" x="0.0" y="179" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="FPb-UJ-alk" id="vRj-wg-vTL">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Automatically Save Drafts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lqn-WQ-Yef">
<rect key="frame" x="16" y="11.5" width="196" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fei-jC-WaU">
<rect key="frame" x="310" y="6.5" width="51" height="31"/>
<connections>
<action selector="automaticallySaveDraftsChanged:" destination="ArB-e7-yko" eventType="valueChanged" id="cDM-q0-y3g"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstItem="lqn-WQ-Yef" firstAttribute="centerY" secondItem="vRj-wg-vTL" secondAttribute="centerY" id="OfL-f9-0TD"/>
<constraint firstItem="lqn-WQ-Yef" firstAttribute="leading" secondItem="vRj-wg-vTL" secondAttribute="leadingMargin" id="PAD-91-xjs"/>
<constraint firstItem="Fei-jC-WaU" firstAttribute="centerY" secondItem="vRj-wg-vTL" secondAttribute="centerY" id="VuC-3Z-594"/>
<constraint firstAttribute="trailingMargin" secondItem="Fei-jC-WaU" secondAttribute="trailing" id="f0d-f8-rrC"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
<tableViewSection id="5L1-9T-nha">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="blue" accessoryType="disclosureIndicator" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" id="eQh-JA-eyx">
<rect key="frame" x="0.0" y="259" width="375" height="44"/>
<rect key="frame" x="0.0" y="123" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="eQh-JA-eyx" id="2y5-gN-4xJ">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
@ -141,14 +94,10 @@
</connections>
</tableView>
<navigationItem key="navigationItem" title="Preferences" id="dN7-yl-voz"/>
<connections>
<outlet property="automaticallySaveDraftsSwitch" destination="Fei-jC-WaU" id="v9v-C2-JJp"/>
<outlet property="defaultPostVisibilityLabel" destination="se3-JR-wRN" id="YQM-H1-DBK"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="GBL-Cz-yNZ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="826" y="-234"/>
<point key="canvasLocation" x="825" y="-234"/>
</scene>
<!--Appearance-->
<scene sceneID="Dvq-ZP-V7u">
@ -292,6 +241,94 @@
</objects>
<point key="canvasLocation" x="2" y="535"/>
</scene>
<!--Behavior-->
<scene sceneID="Ebo-tR-MEU">
<objects>
<tableViewController id="Nk9-yO-78a" customClass="BehaviorTableViewController" customModule="Tusker" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="mh1-En-1nK">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<sections>
<tableViewSection id="aBH-nA-3uG">
<cells>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="d0B-9U-ZkB">
<rect key="frame" x="0.0" y="35" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="d0B-9U-ZkB" id="GI8-Xu-bhJ">
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Default Post Visibility" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xrH-fX-mdk">
<rect key="frame" x="16" y="11.5" width="162" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Public" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OBq-tA-USG">
<rect key="frame" x="286" y="11.5" width="47" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailingMargin" secondItem="OBq-tA-USG" secondAttribute="trailing" id="PEX-ks-Ntx"/>
<constraint firstItem="xrH-fX-mdk" firstAttribute="centerY" secondItem="GI8-Xu-bhJ" secondAttribute="centerY" id="SlK-Id-U1r"/>
<constraint firstItem="OBq-tA-USG" firstAttribute="centerY" secondItem="GI8-Xu-bhJ" secondAttribute="centerY" id="VT7-GB-9U4"/>
<constraint firstItem="xrH-fX-mdk" firstAttribute="leading" secondItem="GI8-Xu-bhJ" secondAttribute="leadingMargin" id="vwm-LF-b6v"/>
</constraints>
</tableViewCellContentView>
<connections>
<segue destination="50Z-Q7-qIn" kind="show" id="i02-r2-FnL"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="T41-nS-8UI">
<rect key="frame" x="0.0" y="79" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="T41-nS-8UI" id="bCk-ll-mpm">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Automatically Save Drafts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2y8-UR-gqh">
<rect key="frame" x="16" y="11.5" width="196" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="HV4-3m-Mal">
<rect key="frame" x="310" y="6.5" width="51" height="31"/>
<connections>
<action selector="automaticallySaveDraftsChanged:" destination="Nk9-yO-78a" eventType="valueChanged" id="oHc-vf-afw"/>
</connections>
</switch>
</subviews>
<constraints>
<constraint firstItem="2y8-UR-gqh" firstAttribute="leading" secondItem="bCk-ll-mpm" secondAttribute="leadingMargin" id="MWr-9X-TKF"/>
<constraint firstItem="HV4-3m-Mal" firstAttribute="centerY" secondItem="bCk-ll-mpm" secondAttribute="centerY" id="Ogg-Sb-CpW"/>
<constraint firstAttribute="trailingMargin" secondItem="HV4-3m-Mal" secondAttribute="trailing" id="h5L-QT-jeb"/>
<constraint firstItem="2y8-UR-gqh" firstAttribute="centerY" secondItem="bCk-ll-mpm" secondAttribute="centerY" id="pZ7-S0-xAN"/>
</constraints>
</tableViewCellContentView>
</tableViewCell>
</cells>
</tableViewSection>
</sections>
<connections>
<outlet property="dataSource" destination="Nk9-yO-78a" id="bN3-mz-nCZ"/>
<outlet property="delegate" destination="Nk9-yO-78a" id="06Z-ze-T6Q"/>
</connections>
</tableView>
<navigationItem key="navigationItem" title="Behavior" id="PaI-hR-64i"/>
<connections>
<outlet property="automaticallySaveDraftsSwitch" destination="HV4-3m-Mal" id="eE1-Q4-za9"/>
<outlet property="defaultPostVisibilityLabel" destination="OBq-tA-USG" id="yFX-yQ-dN9"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="YN6-Jb-XJJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="825" y="528"/>
</scene>
<!--Tabs-->
<scene sceneID="D4Y-D0-S4g">
<objects>
@ -309,7 +346,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8dk-2n-9cx" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1" y="1243"/>
<point key="canvasLocation" x="1" y="1280"/>
</scene>
<!--Default Post Visibility-->
<scene sceneID="z9g-ND-zkU">
@ -348,7 +385,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="JNY-yb-Efi" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="825" y="535"/>
<point key="canvasLocation" x="825" y="1280"/>
</scene>
<!--Advanced-->
<scene sceneID="xgj-Fx-53j">

View File

@ -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
}
}