forked from shadowfacts/Tusker
Remove old tab customization code
This commit is contained in:
parent
7f3128c958
commit
07ce3d41a8
|
@ -58,8 +58,6 @@
|
|||
D6109A0F21459B6900432DC2 /* Pagination.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A0E21459B6900432DC2 /* Pagination.swift */; };
|
||||
D6109A11214607D500432DC2 /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6109A10214607D500432DC2 /* Timeline.swift */; };
|
||||
D6163F2C21AA0AF1008DAC41 /* MyProfileTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6163F2B21AA0AF1008DAC41 /* MyProfileTableViewController.swift */; };
|
||||
D621544B21682AD30003D87D /* TabTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D621544A21682AD30003D87D /* TabTableViewCell.swift */; };
|
||||
D621544D21682AD90003D87D /* TabTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = D621544C21682AD90003D87D /* TabTableViewCell.xib */; };
|
||||
D627FF76217E923E00CC0648 /* DraftsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF75217E923E00CC0648 /* DraftsManager.swift */; };
|
||||
D627FF79217E950100CC0648 /* DraftsTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D627FF78217E950100CC0648 /* DraftsTableViewController.xib */; };
|
||||
D627FF7B217E951500CC0648 /* DraftsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D627FF7A217E951500CC0648 /* DraftsTableViewController.swift */; };
|
||||
|
@ -117,7 +115,6 @@
|
|||
D67C57B221E28FAD00C3118B /* ComposeStatusReplyView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */; };
|
||||
D67C57B421E2910700C3118B /* ComposeStatusReplyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */; };
|
||||
D67E0513216438A7000E0927 /* AppearanceTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67E0512216438A7000E0927 /* AppearanceTableViewController.swift */; };
|
||||
D67E051521643C77000E0927 /* Tab.swift in Sources */ = {isa = PBXBuildFile; fileRef = D67E051421643C77000E0927 /* Tab.swift */; };
|
||||
D686329521ED8319008C716E /* GMImagePicker.strings in Resources */ = {isa = PBXBuildFile; fileRef = D686326E21ED8312008C716E /* GMImagePicker.strings */; };
|
||||
D686329621ED8319008C716E /* GMImagePicker.strings in Resources */ = {isa = PBXBuildFile; fileRef = D686327121ED8312008C716E /* GMImagePicker.strings */; };
|
||||
D686329721ED8319008C716E /* GMGridViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D686327321ED8312008C716E /* GMGridViewCell.m */; };
|
||||
|
@ -288,8 +285,6 @@
|
|||
D6109A0E21459B6900432DC2 /* Pagination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pagination.swift; sourceTree = "<group>"; };
|
||||
D6109A10214607D500432DC2 /* Timeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = "<group>"; };
|
||||
D6163F2B21AA0AF1008DAC41 /* MyProfileTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileTableViewController.swift; sourceTree = "<group>"; };
|
||||
D621544A21682AD30003D87D /* TabTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D621544C21682AD90003D87D /* TabTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TabTableViewCell.xib; sourceTree = "<group>"; };
|
||||
D627FF75217E923E00CC0648 /* DraftsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsManager.swift; sourceTree = "<group>"; };
|
||||
D627FF78217E950100CC0648 /* DraftsTableViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DraftsTableViewController.xib; sourceTree = "<group>"; };
|
||||
D627FF7A217E951500CC0648 /* DraftsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsTableViewController.swift; sourceTree = "<group>"; };
|
||||
|
@ -346,7 +341,6 @@
|
|||
D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeStatusReplyView.xib; sourceTree = "<group>"; };
|
||||
D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusReplyView.swift; sourceTree = "<group>"; };
|
||||
D67E0512216438A7000E0927 /* AppearanceTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceTableViewController.swift; sourceTree = "<group>"; };
|
||||
D67E051421643C77000E0927 /* Tab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tab.swift; sourceTree = "<group>"; };
|
||||
D686326F21ED8312008C716E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = GMImagePicker.strings; sourceTree = "<group>"; };
|
||||
D686327221ED8312008C716E /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = GMImagePicker.strings; sourceTree = "<group>"; };
|
||||
D686327321ED8312008C716E /* GMGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GMGridViewCell.m; sourceTree = "<group>"; };
|
||||
|
@ -588,15 +582,6 @@
|
|||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D621544921682AC60003D87D /* Tab */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D621544C21682AD90003D87D /* TabTableViewCell.xib */,
|
||||
D621544A21682AD30003D87D /* TabTableViewCell.swift */,
|
||||
);
|
||||
path = Tab;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D627FF77217E94F200CC0648 /* Drafts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -773,7 +758,6 @@
|
|||
D663626121360B1900C9CBA2 /* Preferences.swift */,
|
||||
D663626321360D2300C9CBA2 /* AvatarStyle.swift */,
|
||||
D66362692136163000C9CBA2 /* PreferencesAdaptive.swift */,
|
||||
D67E051421643C77000E0927 /* Tab.swift */,
|
||||
);
|
||||
path = Preferences;
|
||||
sourceTree = "<group>";
|
||||
|
@ -901,7 +885,6 @@
|
|||
D641C78A213DD926004B4513 /* Status */,
|
||||
D641C78B213DD92F004B4513 /* Profile Header */,
|
||||
D641C78C213DD937004B4513 /* Notifications */,
|
||||
D621544921682AC60003D87D /* Tab */,
|
||||
D6C693CB2161256B007D6A6D /* Silent Action Permissions */,
|
||||
);
|
||||
path = Views;
|
||||
|
@ -1274,7 +1257,6 @@
|
|||
D60C07E421E8176B0057FAA8 /* ComposeMediaView.xib in Resources */,
|
||||
D667E5E12134937B0057A976 /* StatusTableViewCell.xib in Resources */,
|
||||
D6A5FAF1217B7E05003DB2D9 /* ComposeViewController.xib in Resources */,
|
||||
D621544D21682AD90003D87D /* TabTableViewCell.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1375,13 +1357,11 @@
|
|||
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 */,
|
||||
D62D2424217ABF3F005076CC /* NSUserActivity+Extensions.swift in Sources */,
|
||||
D646C958213B367000269FB5 /* LargeImageShrinkAnimationController.swift in Sources */,
|
||||
D646C956213B365700269FB5 /* LargeImageExpandAnimationController.swift in Sources */,
|
||||
D667E5F82135C3040057A976 /* Mastodon+Equatable.swift in Sources */,
|
||||
D621544B21682AD30003D87D /* TabTableViewCell.swift in Sources */,
|
||||
D67C57B421E2910700C3118B /* ComposeStatusReplyView.swift in Sources */,
|
||||
04DACE8E212CC7CC009840C4 /* ImageCache.swift in Sources */,
|
||||
D627FF7B217E951500CC0648 /* DraftsTableViewController.swift in Sources */,
|
||||
|
|
|
@ -37,7 +37,6 @@ class Preferences: Codable {
|
|||
var showRepliesInProfiles = false
|
||||
var avatarStyle = AvatarStyle.roundRect
|
||||
var hideCustomEmojiInUsernames = false
|
||||
var tabs: [Tab: Int] = [.home: 0, .notifications: 1, .local: -1, .federated: 2, .myProfile: 3, .preferences: 4]
|
||||
|
||||
var defaultPostVisibility = Status.Visibility.public
|
||||
|
||||
|
@ -47,16 +46,6 @@ class Preferences: Codable {
|
|||
var silentActions: [String: Permission] = [:]
|
||||
var statusContentType: StatusContentType = .plain
|
||||
|
||||
// MARK: - Utility Methods
|
||||
func tabIndex(_ tab: Tab) -> Int {
|
||||
if let index = tabs[tab] {
|
||||
return index
|
||||
} else {
|
||||
tabs[tab] = -1
|
||||
return -1
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension Preferences {
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
//
|
||||
// Tab.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 10/2/18.
|
||||
// Copyright © 2018 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
enum Tab: String, Codable, CaseIterable {
|
||||
case home
|
||||
case federated
|
||||
case local
|
||||
case myProfile
|
||||
case notifications
|
||||
case preferences
|
||||
|
||||
var humanName: String {
|
||||
switch self {
|
||||
case .home:
|
||||
return "Home"
|
||||
case .federated:
|
||||
return "Federated"
|
||||
case .local:
|
||||
return "Local"
|
||||
case .myProfile:
|
||||
return "My Profile"
|
||||
case .notifications:
|
||||
return "Notifications"
|
||||
case .preferences:
|
||||
return "Preferences"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -48,10 +48,8 @@ class UserActivityManager {
|
|||
}
|
||||
|
||||
static func handleCheckNotifications(activity: NSUserActivity) {
|
||||
let index = Preferences.shared.tabs[.notifications] ?? -1
|
||||
guard index > 0 else { return }
|
||||
let tabBarController = UIApplication.shared.keyWindow!.rootViewController! as! UITabBarController
|
||||
tabBarController.selectedIndex = index
|
||||
tabBarController.selectedIndex = 2
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
//
|
||||
// TabTableViewCell.swift
|
||||
// Tusker
|
||||
//
|
||||
// Created by Shadowfacts on 10/5/18.
|
||||
// Copyright © 2018 Shadowfacts. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
protocol TabTableViewCellDelegate {
|
||||
func setEnabled(tab: Tab, enabled: Bool)
|
||||
}
|
||||
|
||||
class TabTableViewCell: UITableViewCell {
|
||||
|
||||
var delegate: TabTableViewCellDelegate?
|
||||
|
||||
@IBOutlet weak var nameLabel: UILabel!
|
||||
@IBOutlet weak var enabledSwitch: UISwitch!
|
||||
|
||||
var tab: Tab!
|
||||
|
||||
override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
// compensate for inset created by table view editing mode even when no delete control shown
|
||||
nameLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: -20).isActive = true
|
||||
}
|
||||
|
||||
override func setSelected(_ selected: Bool, animated: Bool) {
|
||||
super.setSelected(selected, animated: animated)
|
||||
}
|
||||
|
||||
func updateUI(for tab: Tab) {
|
||||
self.tab = tab
|
||||
|
||||
enabledSwitch.isEnabled = tab != .preferences
|
||||
enabledSwitch.setOn(Preferences.shared.tabIndex(tab) >= 0, animated: false)
|
||||
nameLabel.text = tab.humanName
|
||||
}
|
||||
|
||||
@IBAction func enabledSwitchChanged(_ sender: Any) {
|
||||
delegate?.setEnabled(tab: tab, enabled: enabledSwitch.isOn)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.23.1" 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.16.1"/>
|
||||
<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="TY9-GT-fyh" customClass="TabTableViewCell" 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="TY9-GT-fyh" id="5RM-4m-Lba">
|
||||
<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="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dsQ-ir-jly">
|
||||
<rect key="frame" x="16" y="11.5" width="45" 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="gxP-eh-ANw">
|
||||
<rect key="frame" x="308" y="6.5" width="51" height="31"/>
|
||||
<connections>
|
||||
<action selector="enabledSwitchChanged:" destination="TY9-GT-fyh" eventType="valueChanged" id="MdE-f1-w07"/>
|
||||
</connections>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="dsQ-ir-jly" firstAttribute="centerY" secondItem="5RM-4m-Lba" secondAttribute="centerY" id="Azd-iZ-FmM"/>
|
||||
<constraint firstItem="gxP-eh-ANw" firstAttribute="centerY" secondItem="5RM-4m-Lba" secondAttribute="centerY" id="Ch4-Gf-4q2"/>
|
||||
<constraint firstItem="dsQ-ir-jly" firstAttribute="leading" secondItem="5RM-4m-Lba" secondAttribute="leadingMargin" placeholder="YES" id="HIe-Qg-Jkj"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gxP-eh-ANw" secondAttribute="trailing" constant="18" id="P7D-Pk-13h"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="enabledSwitch" destination="gxP-eh-ANw" id="BP3-g2-HIV"/>
|
||||
<outlet property="nameLabel" destination="dsQ-ir-jly" id="G9F-tK-Xi3"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-369" y="89"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
Loading…
Reference in New Issue