diff --git a/Tusker.xcodeproj/project.pbxproj b/Tusker.xcodeproj/project.pbxproj index b2487b76..c6ccbfb6 100644 --- a/Tusker.xcodeproj/project.pbxproj +++ b/Tusker.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 04496BD721625361001F1B23 /* ContentLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04496BD621625361001F1B23 /* ContentLabel.swift */; }; + 0450531F22B0097E00100BA2 /* Timline+UI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0450531E22B0097E00100BA2 /* Timline+UI.swift */; }; 0461A3902163CBAE00C0A807 /* Cache.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0461A38F2163CBAE00C0A807 /* Cache.framework */; }; 0461A3912163CBAE00C0A807 /* Cache.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0461A38F2163CBAE00C0A807 /* Cache.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 04DACE8C212CB14B009840C4 /* MainTabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04DACE8B212CB14B009840C4 /* MainTabBarViewController.swift */; }; @@ -235,6 +236,7 @@ /* Begin PBXFileReference section */ 04496BD621625361001F1B23 /* ContentLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentLabel.swift; sourceTree = ""; }; + 0450531E22B0097E00100BA2 /* Timline+UI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Timline+UI.swift"; sourceTree = ""; }; 0461A38F2163CBAE00C0A807 /* Cache.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Cache.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 04DACE8B212CB14B009840C4 /* MainTabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarViewController.swift; sourceTree = ""; }; 04DACE8D212CC7CC009840C4 /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = ""; }; @@ -772,6 +774,7 @@ D6333B362137838300CE884A /* AttributedString+Helpers.swift */, D6333B782139AEFD00CE884A /* Date+TimeAgo.swift */, D67C57AE21E28EAD00C3118B /* Array+Uniques.swift */, + 0450531E22B0097E00100BA2 /* Timline+UI.swift */, ); path = Extensions; sourceTree = ""; @@ -1355,6 +1358,7 @@ D6C693F92162E4DB007D6A6D /* StatusContentLabel.swift in Sources */, D6D58DF922074B74009C8DD9 /* LinkLabel.swift in Sources */, D6285B5121EA6E6E00FE4B39 /* AdvancedTableViewController.swift in Sources */, + 0450531F22B0097E00100BA2 /* Timline+UI.swift in Sources */, D667E5F52135BCD50057A976 /* ConversationTableViewController.swift in Sources */, D6F953F021251A2900CF0F2B /* MastodonController.swift in Sources */, D62D2426217ABF63005076CC /* UserActivityType.swift in Sources */, diff --git a/Tusker/Extensions/Timline+UI.swift b/Tusker/Extensions/Timline+UI.swift new file mode 100644 index 00000000..a0364187 --- /dev/null +++ b/Tusker/Extensions/Timline+UI.swift @@ -0,0 +1,43 @@ +// Timline+UI.swift +// Tusker +// +// Created by Shadowfacts on 6/11/19. +// Copyright © 2019 Shadowfacts. All rights reserved. +// + +import UIKit +import Pachyderm + +extension Timeline { + + var title: String { + switch self { + case .home: + return "Home" + case let .public(local): + return local ? "Local" : "Federated" + case let .tag(hashtag): + return "#\(hashtag)" + case .list: + return "List" + case .direct: + return "Direct" + } + } + + var tabBarImage: UIImage? { + switch self { + case .home: + return UIImage(systemName: "house.fill") + case let .public(local): + if local { + return UIImage(systemName: "person.and.person.fill") + } else { + return UIImage(systemName: "globe") + } + default: + return nil + } + } + +} diff --git a/Tusker/Screens/Compose/ComposeViewController.swift b/Tusker/Screens/Compose/ComposeViewController.swift index 349e1530..3a48682b 100644 --- a/Tusker/Screens/Compose/ComposeViewController.swift +++ b/Tusker/Screens/Compose/ComposeViewController.swift @@ -81,6 +81,7 @@ class ComposeViewController: UIViewController { super.init(nibName: "ComposeViewController", bundle: nil) title = "Compose" + tabBarItem.image = UIImage(systemName: "pencil") navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancelButtonPressed)) navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Post", style: .done, target: self, action: #selector(postButtonPressed)) diff --git a/Tusker/Screens/Notifications/NotificationsTableViewController.swift b/Tusker/Screens/Notifications/NotificationsTableViewController.swift index c19adb7e..416c671a 100644 --- a/Tusker/Screens/Notifications/NotificationsTableViewController.swift +++ b/Tusker/Screens/Notifications/NotificationsTableViewController.swift @@ -25,7 +25,9 @@ class NotificationsTableViewController: EnhancedTableViewController { init() { super.init(style: .plain) - self.title = "Notifications" + title = "Notifications" + tabBarItem.image = UIImage(systemName: "bell.fill") + self.refreshControl = UIRefreshControl() refreshControl!.addTarget(self, action: #selector(refreshNotifications(_:)), for: .valueChanged) } diff --git a/Tusker/Screens/Onboarding/OnboardingViewController.swift b/Tusker/Screens/Onboarding/OnboardingViewController.swift index 7a1e0c1f..b40d62a3 100644 --- a/Tusker/Screens/Onboarding/OnboardingViewController.swift +++ b/Tusker/Screens/Onboarding/OnboardingViewController.swift @@ -85,6 +85,6 @@ class OnboardingViewController: UIViewController { extension OnboardingViewController: ASWebAuthenticationPresentationContextProviding { func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor { - return UIApplication.shared.delegate!.window!! + return view.window! } } diff --git a/Tusker/Screens/Profile/MyProfileTableViewController.swift b/Tusker/Screens/Profile/MyProfileTableViewController.swift index 7c1c2868..170a6d61 100644 --- a/Tusker/Screens/Profile/MyProfileTableViewController.swift +++ b/Tusker/Screens/Profile/MyProfileTableViewController.swift @@ -14,19 +14,22 @@ class MyProfileTableViewController: ProfileTableViewController { super.init(accountID: nil) title = "My Profile" + tabBarItem.image = UIImage(systemName: "person.fill") + MastodonController.getOwnAccount { (account) in self.accountID = account.id ImageCache.avatars.get(account.avatar, completion: { (data) in guard let data = data else { return } - var image = UIImage(data: data)! - image = UIGraphicsImageRenderer(size: CGSize(width: 30, height: 30)).image(actions: { (_) in - image.draw(in: CGRect(x: 0, y: 0, width: 30, height: 30)) - }) - image = image.withRenderingMode(.alwaysOriginal) DispatchQueue.main.async { - self.tabBarItem.image = image + let image = UIImage(data: data)! + let size = CGSize(width: 30, height: 30) + let tabBarImage = UIGraphicsImageRenderer(size: size).image { (_) in + image.draw(in: CGRect(origin: .zero, size: size)) + } + let alwaysOriginalImage = tabBarImage.withRenderingMode(.alwaysOriginal) + self.tabBarItem.image = alwaysOriginalImage } }) } @@ -42,6 +45,10 @@ class MyProfileTableViewController: ProfileTableViewController { super.viewDidLoad() } + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + } + @objc func preferencesPressed() { present(PreferencesTableViewController.create(), animated: true) } diff --git a/Tusker/Screens/Timeline/TimelineTableViewController.swift b/Tusker/Screens/Timeline/TimelineTableViewController.swift index 587de5e9..b6854fd4 100644 --- a/Tusker/Screens/Timeline/TimelineTableViewController.swift +++ b/Tusker/Screens/Timeline/TimelineTableViewController.swift @@ -42,18 +42,8 @@ class TimelineTableViewController: EnhancedTableViewController { super.init(style: .plain) - switch timeline { - case .home: - title = "Home" - case let .public(local): - title = local ? "Local" : "Federated" - case let .tag(hashtag): - title = "#\(hashtag)" - case .list: - title = "List" - case .direct: - title = "Direct" - } + title = timeline.title + tabBarItem.image = timeline.tabBarImage self.refreshControl = UIRefreshControl() refreshControl!.addTarget(self, action: #selector(refreshStatuses(_:)), for: .valueChanged) diff --git a/Tusker/Views/Profile Header/ProfileHeaderTableViewCell.xib b/Tusker/Views/Profile Header/ProfileHeaderTableViewCell.xib index 98eb1c1c..502b3c55 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderTableViewCell.xib +++ b/Tusker/Views/Profile Header/ProfileHeaderTableViewCell.xib @@ -5,6 +5,7 @@ + @@ -48,7 +49,7 @@ @@ -80,13 +81,10 @@ - + @@ -157,9 +145,9 @@ - - - - + + + + diff --git a/Tusker/Views/Status/StatusTableViewCell.xib b/Tusker/Views/Status/StatusTableViewCell.xib index f2d1c3da..31eef1d4 100644 --- a/Tusker/Views/Status/StatusTableViewCell.xib +++ b/Tusker/Views/Status/StatusTableViewCell.xib @@ -24,7 +24,7 @@ - + @@ -60,7 +60,7 @@ - - + + - + @@ -165,9 +153,9 @@ - - - - + + + +