diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index 429149460f..fc4e927eac 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -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 = ""; }; D6109A10214607D500432DC2 /* Timeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Timeline.swift; sourceTree = ""; }; D6163F2B21AA0AF1008DAC41 /* MyProfileTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyProfileTableViewController.swift; sourceTree = ""; }; - D621544A21682AD30003D87D /* TabTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabTableViewCell.swift; sourceTree = ""; }; - D621544C21682AD90003D87D /* TabTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TabTableViewCell.xib; sourceTree = ""; }; D627FF75217E923E00CC0648 /* DraftsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsManager.swift; sourceTree = ""; }; D627FF78217E950100CC0648 /* DraftsTableViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DraftsTableViewController.xib; sourceTree = ""; }; D627FF7A217E951500CC0648 /* DraftsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsTableViewController.swift; sourceTree = ""; }; @@ -346,7 +341,6 @@ D67C57B121E28FAD00C3118B /* ComposeStatusReplyView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeStatusReplyView.xib; sourceTree = ""; }; D67C57B321E2910700C3118B /* ComposeStatusReplyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeStatusReplyView.swift; sourceTree = ""; }; D67E0512216438A7000E0927 /* AppearanceTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearanceTableViewController.swift; sourceTree = ""; }; - D67E051421643C77000E0927 /* Tab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tab.swift; sourceTree = ""; }; D686326F21ED8312008C716E /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = GMImagePicker.strings; sourceTree = ""; }; D686327221ED8312008C716E /* ca */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ca; path = GMImagePicker.strings; sourceTree = ""; }; D686327321ED8312008C716E /* GMGridViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GMGridViewCell.m; sourceTree = ""; }; @@ -588,15 +582,6 @@ path = Model; sourceTree = ""; }; - D621544921682AC60003D87D /* Tab */ = { - isa = PBXGroup; - children = ( - D621544C21682AD90003D87D /* TabTableViewCell.xib */, - D621544A21682AD30003D87D /* TabTableViewCell.swift */, - ); - path = Tab; - sourceTree = ""; - }; D627FF77217E94F200CC0648 /* Drafts */ = { isa = PBXGroup; children = ( @@ -773,7 +758,6 @@ D663626121360B1900C9CBA2 /* Preferences.swift */, D663626321360D2300C9CBA2 /* AvatarStyle.swift */, D66362692136163000C9CBA2 /* PreferencesAdaptive.swift */, - D67E051421643C77000E0927 /* Tab.swift */, ); path = Preferences; sourceTree = ""; @@ -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 */, diff --git a/Tusker/Preferences/Preferences.swift b/Tusker/Preferences/Preferences.swift index e6ac38a728..08d386e39d 100644 --- a/Tusker/Preferences/Preferences.swift +++ b/Tusker/Preferences/Preferences.swift @@ -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 { diff --git a/Tusker/Preferences/Tab.swift b/Tusker/Preferences/Tab.swift deleted file mode 100644 index 34ede19259..0000000000 --- a/Tusker/Preferences/Tab.swift +++ /dev/null @@ -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" - } - } -} diff --git a/Tusker/Screens/Main/MainTabBarViewController.swift b/Tusker/Screens/Main/MainTabBarViewController.swift index 547df8d3e6..6bb6bf15a4 100644 --- a/Tusker/Screens/Main/MainTabBarViewController.swift +++ b/Tusker/Screens/Main/MainTabBarViewController.swift @@ -2,7 +2,7 @@ // MainTabBarViewController.swift // Tusker // -// Created by Shadowfactson 8/21/18. +// Created by Shadowfacts on 8/21/18. // Copyright © 2018 Shadowfacts. All rights reserved. // diff --git a/Tusker/Shortcuts/UserActivityManager.swift b/Tusker/Shortcuts/UserActivityManager.swift index ee41dc59a4..b9db59ccfc 100644 --- a/Tusker/Shortcuts/UserActivityManager.swift +++ b/Tusker/Shortcuts/UserActivityManager.swift @@ -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 } } diff --git a/Tusker/Views/Tab/TabTableViewCell.swift b/Tusker/Views/Tab/TabTableViewCell.swift deleted file mode 100644 index 23ccde0e02..0000000000 --- a/Tusker/Views/Tab/TabTableViewCell.swift +++ /dev/null @@ -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) - } - -} diff --git a/Tusker/Views/Tab/TabTableViewCell.xib b/Tusker/Views/Tab/TabTableViewCell.xib deleted file mode 100644 index d6c353d4f5..0000000000 --- a/Tusker/Views/Tab/TabTableViewCell.xib +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -