From c07e2cfdd8c49cebb443f30c7c1bd621154c9c4e Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 30 Nov 2022 17:05:18 -0500 Subject: [PATCH] Add more possibilities to relationship label on profile header --- .../Profile Header/ProfileHeaderView.swift | 23 +++++++++++++++---- .../Profile Header/ProfileHeaderView.xib | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Tusker/Views/Profile Header/ProfileHeaderView.swift b/Tusker/Views/Profile Header/ProfileHeaderView.swift index 2baf56d3..2d770051 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderView.swift +++ b/Tusker/Views/Profile Header/ProfileHeaderView.swift @@ -35,7 +35,7 @@ class ProfileHeaderView: UIView { @IBOutlet weak var displayNameLabel: EmojiLabel! @IBOutlet weak var usernameLabel: UILabel! @IBOutlet weak var lockImageView: UIImageView! - @IBOutlet weak var followsYouLabel: UILabel! + @IBOutlet weak var relationshipLabel: UILabel! @IBOutlet weak var noteTextView: StatusContentTextView! @IBOutlet weak var fieldsView: ProfileFieldsView! @IBOutlet weak var pagesSegmentedControl: UISegmentedControl! @@ -77,8 +77,8 @@ class ProfileHeaderView: UIView { usernameLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .light)) usernameLabel.adjustsFontForContentSizeCategory = true - followsYouLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14)) - followsYouLabel.adjustsFontForContentSizeCategory = true + relationshipLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14)) + relationshipLabel.adjustsFontForContentSizeCategory = true noteTextView.defaultFont = .preferredFont(forTextStyle: .body) noteTextView.adjustsFontForContentSizeCategory = true @@ -163,7 +163,22 @@ class ProfileHeaderView: UIView { return } - followsYouLabel.isHidden = !relationship.followedBy + var relationshipStr: String? + if relationship.following && relationship.followedBy { + relationshipStr = "You follow each other" + } else if relationship.following { + relationshipStr = "You follow" + } else if relationship.followedBy { + relationshipStr = "Follows you" + } else if relationship.blocking { + relationshipStr = "You block" + } + if let relationshipStr { + relationshipLabel.text = relationshipStr + relationshipLabel.isHidden = false + } else { + relationshipLabel.isHidden = true + } } @objc private func updateUIForPreferences() { diff --git a/Tusker/Views/Profile Header/ProfileHeaderView.xib b/Tusker/Views/Profile Header/ProfileHeaderView.xib index b5648f39..645dabe7 100644 --- a/Tusker/Views/Profile Header/ProfileHeaderView.xib +++ b/Tusker/Views/Profile Header/ProfileHeaderView.xib @@ -153,12 +153,12 @@ - +