Add preferences UI for silent XCB actions
This commit is contained in:
parent
569c21b49b
commit
38f072ae62
|
@ -99,6 +99,9 @@
|
|||
D679C09F215850EF00DA27FE /* XCBActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D679C09E215850EF00DA27FE /* XCBActions.swift */; };
|
||||
D6BED170212663DA00F02DA0 /* SwiftSoup.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
D6BED174212667E900F02DA0 /* StatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */; };
|
||||
D6C693CA2161253F007D6A6D /* SilentActionPermissionsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693C92161253F007D6A6D /* SilentActionPermissionsTableViewController.swift */; };
|
||||
D6C693CD2161257B007D6A6D /* SilentActionPermissionCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D6C693CC2161257B007D6A6D /* SilentActionPermissionCell.xib */; };
|
||||
D6C693CF216125FC007D6A6D /* SilentActionPermissionTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C693CE216125FC007D6A6D /* SilentActionPermissionTableViewCell.swift */; };
|
||||
D6C94D852139DFD800CB5196 /* LargeImage.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D6C94D842139DFD800CB5196 /* LargeImage.storyboard */; };
|
||||
D6C94D872139E62700CB5196 /* LargeImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C94D862139E62700CB5196 /* LargeImageViewController.swift */; };
|
||||
D6C94D892139E6EC00CB5196 /* AttachmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C94D882139E6EC00CB5196 /* AttachmentView.swift */; };
|
||||
|
@ -261,6 +264,9 @@
|
|||
D679C09E215850EF00DA27FE /* XCBActions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XCBActions.swift; sourceTree = "<group>"; };
|
||||
D6BED16E212663DA00F02DA0 /* SwiftSoup.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = SwiftSoup.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D6BED173212667E900F02DA0 /* StatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D6C693C92161253F007D6A6D /* SilentActionPermissionsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilentActionPermissionsTableViewController.swift; sourceTree = "<group>"; };
|
||||
D6C693CC2161257B007D6A6D /* SilentActionPermissionCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SilentActionPermissionCell.xib; sourceTree = "<group>"; };
|
||||
D6C693CE216125FC007D6A6D /* SilentActionPermissionTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SilentActionPermissionTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D6C94D842139DFD800CB5196 /* LargeImage.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LargeImage.storyboard; sourceTree = "<group>"; };
|
||||
D6C94D862139E62700CB5196 /* LargeImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargeImageViewController.swift; sourceTree = "<group>"; };
|
||||
D6C94D882139E6EC00CB5196 /* AttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentView.swift; sourceTree = "<group>"; };
|
||||
|
@ -506,6 +512,7 @@
|
|||
D663626521360DD700C9CBA2 /* Preferences.storyboard */,
|
||||
D663626721360E2C00C9CBA2 /* PreferencesTableViewController.swift */,
|
||||
D641C78E213DF2AA004B4513 /* VisibilityTableViewController.swift */,
|
||||
D6C693C92161253F007D6A6D /* SilentActionPermissionsTableViewController.swift */,
|
||||
);
|
||||
path = Preferences;
|
||||
sourceTree = "<group>";
|
||||
|
@ -607,10 +614,20 @@
|
|||
D641C78A213DD926004B4513 /* Status */,
|
||||
D641C78B213DD92F004B4513 /* Profile Header */,
|
||||
D641C78C213DD937004B4513 /* Notifications */,
|
||||
D6C693CB2161256B007D6A6D /* Silent Action Permissions */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D6C693CB2161256B007D6A6D /* Silent Action Permissions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D6C693CC2161257B007D6A6D /* SilentActionPermissionCell.xib */,
|
||||
D6C693CE216125FC007D6A6D /* SilentActionPermissionTableViewCell.swift */,
|
||||
);
|
||||
path = "Silent Action Permissions";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D6D4DDC3212518A000E1C4BB = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -864,6 +881,7 @@
|
|||
D641C779213CAC56004B4513 /* ActionNotificationTableViewCell.xib in Resources */,
|
||||
D667E5F32135BC260057A976 /* Conversation.storyboard in Resources */,
|
||||
D667E5E921349EE50057A976 /* ProfileHeaderTableViewCell.xib in Resources */,
|
||||
D6C693CD2161257B007D6A6D /* SilentActionPermissionCell.xib in Resources */,
|
||||
D6D4DDDA212518A200E1C4BB /* LaunchScreen.storyboard in Resources */,
|
||||
D64D0AAF2128D954005A6F37 /* Onboarding.storyboard in Resources */,
|
||||
D6D4DDD7212518A200E1C4BB /* Assets.xcassets in Resources */,
|
||||
|
@ -977,6 +995,7 @@
|
|||
D641C78F213DF2AA004B4513 /* VisibilityTableViewController.swift in Sources */,
|
||||
D641C77F213DC78A004B4513 /* InlineTextAttachment.swift in Sources */,
|
||||
D663626C21361C6700C9CBA2 /* Account+Preferences.swift in Sources */,
|
||||
D6C693CA2161253F007D6A6D /* SilentActionPermissionsTableViewController.swift in Sources */,
|
||||
D6333B372137838300CE884A /* AttributedString+Trim.swift in Sources */,
|
||||
D667E5EF2134C39F0057A976 /* StatusContentLabel.swift in Sources */,
|
||||
D641C777213CAA9E004B4513 /* ActionNotificationTableViewCell.swift in Sources */,
|
||||
|
@ -992,6 +1011,7 @@
|
|||
D641C773213CAA25004B4513 /* NotificationsTableViewController.swift in Sources */,
|
||||
D6757A7C2157E01900721E32 /* XCBManager.swift in Sources */,
|
||||
D64A0CD32132153900640E3B /* HTMLContentLabel.swift in Sources */,
|
||||
D6C693CF216125FC007D6A6D /* SilentActionPermissionTableViewCell.swift in Sources */,
|
||||
D6757A7E2157E02600721E32 /* XCBRequestSpec.swift in Sources */,
|
||||
D667E5F12134D5050057A976 /* UIViewController+Delegates.swift in Sources */,
|
||||
D663625F2135C75500C9CBA2 /* ConversationMainStatusTableViewCell.swift in Sources */,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="VJJ-jC-9g8">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.15" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="VJJ-jC-9g8">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.9"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.9"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iCG-F0-6ZK">
|
||||
<rect key="frame" x="310" y="6.5" width="51" height="31"/>
|
||||
<rect key="frame" x="308" y="6.5" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="showRepliesInProfilesChanged:" destination="ArB-e7-yko" eventType="valueChanged" id="viU-pi-47n"/>
|
||||
</connections>
|
||||
|
@ -41,7 +41,7 @@
|
|||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="iCG-F0-6ZK" firstAttribute="centerY" secondItem="PFp-4A-2ka" secondAttribute="centerY" id="7aD-RX-CTV"/>
|
||||
<constraint firstAttribute="trailing" secondItem="iCG-F0-6ZK" secondAttribute="trailing" constant="16" id="Vns-XW-ptr"/>
|
||||
<constraint firstAttribute="trailing" secondItem="iCG-F0-6ZK" secondAttribute="trailing" constant="18" id="Vns-XW-ptr"/>
|
||||
<constraint firstItem="DkZ-zq-Q4w" firstAttribute="centerY" secondItem="PFp-4A-2ka" secondAttribute="centerY" id="lGl-bs-NXC"/>
|
||||
<constraint firstItem="DkZ-zq-Q4w" firstAttribute="leading" secondItem="PFp-4A-2ka" secondAttribute="leadingMargin" id="s8Y-iu-VJ6"/>
|
||||
</constraints>
|
||||
|
@ -61,7 +61,7 @@
|
|||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EGF-Yh-zaU">
|
||||
<rect key="frame" x="310" y="6.5" width="51" height="31"/>
|
||||
<rect key="frame" x="308" y="6.5" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="circularAvatarsChanged:" destination="ArB-e7-yko" eventType="valueChanged" id="ZvM-jR-xgg"/>
|
||||
</connections>
|
||||
|
@ -70,7 +70,7 @@
|
|||
<constraints>
|
||||
<constraint firstItem="GJd-z5-4ad" firstAttribute="centerY" secondItem="dcx-Vr-nHa" secondAttribute="centerY" id="BWk-p9-4xR"/>
|
||||
<constraint firstItem="EGF-Yh-zaU" firstAttribute="centerY" secondItem="dcx-Vr-nHa" secondAttribute="centerY" id="KOD-1g-yqy"/>
|
||||
<constraint firstAttribute="trailing" secondItem="EGF-Yh-zaU" secondAttribute="trailing" constant="16" id="Ncq-4V-0mW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="EGF-Yh-zaU" secondAttribute="trailing" constant="18" id="Ncq-4V-0mW"/>
|
||||
<constraint firstItem="GJd-z5-4ad" firstAttribute="leading" secondItem="dcx-Vr-nHa" secondAttribute="leadingMargin" id="pFh-IN-rcq"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
|
@ -89,7 +89,7 @@
|
|||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vWi-fm-tjV">
|
||||
<rect key="frame" x="310" y="6.5" width="51" height="31"/>
|
||||
<rect key="frame" x="308" y="6.5" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="hideCustomEmojiInUsernamesChanged:" destination="ArB-e7-yko" eventType="valueChanged" id="1Tm-o6-ssu"/>
|
||||
</connections>
|
||||
|
@ -99,7 +99,7 @@
|
|||
<constraint firstItem="vWi-fm-tjV" firstAttribute="centerY" secondItem="oE9-YZ-9kb" secondAttribute="centerY" id="64b-0G-5hd"/>
|
||||
<constraint firstItem="4bl-xs-4DS" firstAttribute="centerY" secondItem="oE9-YZ-9kb" secondAttribute="centerY" id="9ws-m8-Hf6"/>
|
||||
<constraint firstItem="4bl-xs-4DS" firstAttribute="leading" secondItem="oE9-YZ-9kb" secondAttribute="leadingMargin" id="nTB-KX-h8P"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vWi-fm-tjV" secondAttribute="trailing" constant="16" id="xM8-1M-HWj"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vWi-fm-tjV" secondAttribute="trailing" constant="18" id="xM8-1M-HWj"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
|
@ -140,6 +140,33 @@
|
|||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
<tableViewSection 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="283" 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">
|
||||
<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="Advanced" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iEj-dZ-E4F">
|
||||
<rect key="frame" x="16" y="11.5" width="77" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="iEj-dZ-E4F" firstAttribute="leading" secondItem="NJF-ED-5cF" secondAttribute="leadingMargin" id="X5l-TE-I3w"/>
|
||||
<constraint firstItem="iEj-dZ-E4F" firstAttribute="centerY" secondItem="NJF-ED-5cF" secondAttribute="centerY" id="rak-B9-rwy"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="3mv-l7-6We" kind="show" id="LGp-xW-KyG"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="ArB-e7-yko" id="Kxa-qc-mae"/>
|
||||
|
@ -195,7 +222,74 @@
|
|||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="JNY-yb-Efi" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1654" y="-234"/>
|
||||
<point key="canvasLocation" x="1612" y="-566"/>
|
||||
</scene>
|
||||
<!--Advanced-->
|
||||
<scene sceneID="xgj-Fx-53j">
|
||||
<objects>
|
||||
<tableViewController id="3mv-l7-6We" 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="hcR-ju-th0">
|
||||
<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 headerTitle="Automation" id="eWp-x3-oMd">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" id="O0c-tR-bX1">
|
||||
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="O0c-tR-bX1" id="im1-BJ-7Ov">
|
||||
<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="Silent Action Permissions" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dxZ-65-xsN">
|
||||
<rect key="frame" x="16" y="11.5" width="193" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="dxZ-65-xsN" firstAttribute="centerY" secondItem="im1-BJ-7Ov" secondAttribute="centerY" id="8kb-23-tWR"/>
|
||||
<constraint firstItem="dxZ-65-xsN" firstAttribute="leading" secondItem="im1-BJ-7Ov" secondAttribute="leadingMargin" id="cx9-eY-n5y"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="aHP-YB-bnY" kind="show" id="YTT-Nh-TBJ"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="3mv-l7-6We" id="Ots-vG-253"/>
|
||||
<outlet property="delegate" destination="3mv-l7-6We" id="sgz-7z-l0C"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Advanced" id="Rav-Eq-k22"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="4wC-Hp-AZk" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1618" y="114"/>
|
||||
</scene>
|
||||
<!--Silent Actions-->
|
||||
<scene sceneID="Vyy-sh-Tca">
|
||||
<objects>
|
||||
<tableViewController id="aHP-YB-bnY" customClass="SilentActionPermissionsTableViewController" customModule="Tusker" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="Bpx-p9-yXW">
|
||||
<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"/>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="aHP-YB-bnY" id="f9C-VF-QBf"/>
|
||||
<outlet property="delegate" destination="aHP-YB-bnY" id="8P5-YV-yop"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Silent Actions" id="W0R-yx-QyV"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Db4-9Z-l6U" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="2404" y="110"/>
|
||||
</scene>
|
||||
<!--Preferences-->
|
||||
<scene sceneID="3UV-H1-kd4">
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
//
|
||||
// SilentActionPermissionsTableViewController.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 9/30/18.
|
||||
// Copyright © 2018 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SilentActionPermissionsTableViewController: UITableViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
tableView.register(UINib(nibName: "SilentActionPermissionCell", bundle: nil), forCellReuseIdentifier: "permissionCell")
|
||||
}
|
||||
|
||||
// MARK: - Table view data source
|
||||
|
||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
||||
return 1
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return Preferences.shared.silentActions.count
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
guard let cell = tableView.dequeueReusableCell(withIdentifier: "permissionCell", for: indexPath) as? SilentActionPermissionTableViewCell else { fatalError() }
|
||||
|
||||
let index = Preferences.shared.silentActions.index(Preferences.shared.silentActions.startIndex, offsetBy: indexPath.row)
|
||||
let (source, permission) = Preferences.shared.silentActions[index]
|
||||
cell.updateUI(source: source, permission: permission)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
/*
|
||||
// MARK: - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
||||
// Get the new view controller using segue.destination.
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.15" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.9"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="GWO-i6-L8m" customClass="SilentActionPermissionTableViewCell" customModule="Tusker" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="GWO-i6-L8m" id="qzg-4f-0uU">
|
||||
<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="Source" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SBJ-9L-ag4">
|
||||
<rect key="frame" x="16" y="11.5" width="54" 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="26Y-44-Oe5">
|
||||
<rect key="frame" x="308" y="6.5" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="permissionSwitchChanged:" destination="GWO-i6-L8m" eventType="valueChanged" id="JrM-Y3-sI5"/>
|
||||
</connections>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="26Y-44-Oe5" firstAttribute="centerY" secondItem="qzg-4f-0uU" secondAttribute="centerY" id="SUw-Tc-yzL"/>
|
||||
<constraint firstItem="SBJ-9L-ag4" firstAttribute="centerY" secondItem="qzg-4f-0uU" secondAttribute="centerY" id="Z1b-IJ-iCl"/>
|
||||
<constraint firstAttribute="trailing" secondItem="26Y-44-Oe5" secondAttribute="trailing" constant="18" id="teI-XC-sUD"/>
|
||||
<constraint firstItem="SBJ-9L-ag4" firstAttribute="leading" secondItem="qzg-4f-0uU" secondAttribute="leadingMargin" id="uNh-f9-9cS"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="permissionSwitch" destination="26Y-44-Oe5" id="7QZ-U2-MQ7"/>
|
||||
<outlet property="sourceLabel" destination="SBJ-9L-ag4" id="I3s-cf-ZtI"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-42" y="161"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// SilentActionPermissionTableViewCell.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 9/30/18.
|
||||
// Copyright © 2018 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class SilentActionPermissionTableViewCell: UITableViewCell {
|
||||
|
||||
@IBOutlet weak var sourceLabel: UILabel!
|
||||
@IBOutlet weak var permissionSwitch: UISwitch!
|
||||
|
||||
var source: String!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
}
|
||||
|
||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
}
|
||||
|
||||
func updateUI(source: String, permission: Preferences.Permission) {
|
||||
self.source = source
|
||||
sourceLabel.text = source
|
||||
permissionSwitch.setOn(permission == .accepted, animated: false)
|
||||
}
|
||||
|
||||
@IBAction func permissionSwitchChanged(_ sender: Any) {
|
||||
Preferences.shared.silentActions[source] = permissionSwitch.isOn ? .accepted : .rejected
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue