diff --git a/Tusker/Screens/Account Follows/AccountFollowsViewController.swift b/Tusker/Screens/Account Follows/AccountFollowsViewController.swift index 6077b85d03..cc7775fb2b 100644 --- a/Tusker/Screens/Account Follows/AccountFollowsViewController.swift +++ b/Tusker/Screens/Account Follows/AccountFollowsViewController.swift @@ -13,11 +13,11 @@ class AccountFollowsViewController: SegmentedPageViewController: UIView let segmentedControl = ScrollingSegmentedControl() - init(pages: [Page], pageProvider: @escaping (Page) -> UIViewController) { + init(pages: [Page], initialPage: Page? = nil, pageProvider: @escaping (Page) -> UIViewController) { precondition(!pages.isEmpty) self.pageProvider = pageProvider - initialPage = pages.first! - currentPage = pages.first! + self.initialPage = initialPage ?? pages.first! + currentPage = self.initialPage super.init(nibName: nil, bundle: nil) @@ -48,7 +48,7 @@ class SegmentedPageViewController: UIView // the segemented control itself is only focusable when VoiceOver is in Group navigation mode, // so make it clear that to switch tabs the user needs to enter the group segmentedControl.accessibilityHint = "Enter group to select timeline" - segmentedControl.setSelectedOption(segmentedControl.options.first!.value, animated: false) + segmentedControl.setSelectedOption(self.initialPage, animated: false) navigationItem.titleView = segmentedControl } @@ -94,6 +94,7 @@ class SegmentedPageViewController: UIView } } + // Extension point for subclasses func configureViewController(_ viewController: UIViewController) { } diff --git a/Tusker/Views/Profile Header/ProfileHeaderView.swift b/Tusker/Views/Profile Header/ProfileHeaderView.swift index 731f4787f3..bfaeb93547 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderView.swift +++ b/Tusker/Views/Profile Header/ProfileHeaderView.swift @@ -36,7 +36,8 @@ class ProfileHeaderView: UIView { @IBOutlet weak var relationshipLabel: UILabel! @IBOutlet weak var noteTextView: StatusContentTextView! @IBOutlet weak var fieldsView: ProfileFieldsView! - @IBOutlet weak var followCountButton: UIButton! + @IBOutlet weak var followingCountButton: UIButton! + @IBOutlet weak var followersCountButton: UIButton! private(set) var pagesSegmentedControl: ScrollingSegmentedControl! private var movedOverlayView: ProfileHeaderMovedOverlayView? @@ -159,21 +160,22 @@ class ProfileHeaderView: UIView { let (followingAbbr, followingSpelledOut) = formatBigNumber(account.followingCount) let (followersAbbr, followersSpelledOut) = formatBigNumber(account.followersCount) - let followCountTitle = NSMutableAttributedString() - followCountTitle.append(NSAttributedString(string: followingAbbr, attributes: [ + let followingCountTitle = NSMutableAttributedString(string: followingAbbr, attributes: [ .font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!, - ])) - followCountTitle.append(NSAttributedString(string: " Following, ", attributes: [ + ]) + followingCountTitle.append(NSAttributedString(string: " Following", attributes: [ .foregroundColor: UIColor.secondaryLabel, ])) - followCountTitle.append(NSAttributedString(string: followersAbbr, attributes: [ + let followersCountTitle = NSMutableAttributedString(string: followersAbbr, attributes: [ .font: UIFont.preferredFont(forTextStyle: .body).withTraits(.traitBold)!, - ])) - followCountTitle.append(NSAttributedString(string: " Follower\(account.followersCount == 1 ? "" : "s")", attributes: [ + ]) + followersCountTitle.append(NSAttributedString(string: " Follower\(account.followersCount == 1 ? "" : "s")", attributes: [ .foregroundColor: UIColor.secondaryLabel, ])) - followCountButton.setAttributedTitle(followCountTitle, for: .normal) - followCountButton.accessibilityLabel = "\(followingSpelledOut) following, \(followersSpelledOut) followers" + followingCountButton.setAttributedTitle(followingCountTitle, for: .normal) + followingCountButton.accessibilityLabel = "\(followingSpelledOut) following" + followersCountButton.setAttributedTitle(followersCountTitle, for: .normal) + followersCountButton.accessibilityLabel = "\(followersSpelledOut) followers" if let movedTo = account.movedTo { if let movedOverlayView { @@ -398,9 +400,14 @@ class ProfileHeaderView: UIView { } } - @IBAction func followCountButtonPressed(_ sender: Any) { + @IBAction func followingCountButtonPressed(_ sender: Any) { guard let accountID else { return } - delegate?.show(AccountFollowsViewController(accountID: accountID, mastodonController: mastodonController)) + delegate?.show(AccountFollowsViewController(accountID: accountID, initialPage: .following, mastodonController: mastodonController)) + } + + @IBAction func followersCountButtonPressed(_ sender: Any) { + guard let accountID else { return } + delegate?.show(AccountFollowsViewController(accountID: accountID, initialPage: .followers, mastodonController: mastodonController)) } } diff --git a/Tusker/Views/Profile Header/ProfileHeaderView.xib b/Tusker/Views/Profile Header/ProfileHeaderView.xib index 92df251473..086b35dff5 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderView.xib +++ b/Tusker/Views/Profile Header/ProfileHeaderView.xib @@ -1,9 +1,9 @@ - + - + @@ -71,36 +71,53 @@ - + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. - + - + - + + + + + + + @@ -156,7 +173,8 @@ - + +