forked from shadowfacts/Tusker
Add more possibilities to relationship label on profile header
This commit is contained in:
parent
db7615d26f
commit
c07e2cfdd8
|
@ -35,7 +35,7 @@ class ProfileHeaderView: UIView {
|
||||||
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
@IBOutlet weak var displayNameLabel: EmojiLabel!
|
||||||
@IBOutlet weak var usernameLabel: UILabel!
|
@IBOutlet weak var usernameLabel: UILabel!
|
||||||
@IBOutlet weak var lockImageView: UIImageView!
|
@IBOutlet weak var lockImageView: UIImageView!
|
||||||
@IBOutlet weak var followsYouLabel: UILabel!
|
@IBOutlet weak var relationshipLabel: UILabel!
|
||||||
@IBOutlet weak var noteTextView: StatusContentTextView!
|
@IBOutlet weak var noteTextView: StatusContentTextView!
|
||||||
@IBOutlet weak var fieldsView: ProfileFieldsView!
|
@IBOutlet weak var fieldsView: ProfileFieldsView!
|
||||||
@IBOutlet weak var pagesSegmentedControl: UISegmentedControl!
|
@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.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 15, weight: .light))
|
||||||
usernameLabel.adjustsFontForContentSizeCategory = true
|
usernameLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
followsYouLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14))
|
relationshipLabel.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 14))
|
||||||
followsYouLabel.adjustsFontForContentSizeCategory = true
|
relationshipLabel.adjustsFontForContentSizeCategory = true
|
||||||
|
|
||||||
noteTextView.defaultFont = .preferredFont(forTextStyle: .body)
|
noteTextView.defaultFont = .preferredFont(forTextStyle: .body)
|
||||||
noteTextView.adjustsFontForContentSizeCategory = true
|
noteTextView.adjustsFontForContentSizeCategory = true
|
||||||
|
@ -163,7 +163,22 @@ class ProfileHeaderView: UIView {
|
||||||
return
|
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() {
|
@objc private func updateUIForPreferences() {
|
||||||
|
|
|
@ -153,12 +153,12 @@
|
||||||
<outlet property="avatarImageView" destination="TkY-oK-if4" id="bSJ-7z-j4w"/>
|
<outlet property="avatarImageView" destination="TkY-oK-if4" id="bSJ-7z-j4w"/>
|
||||||
<outlet property="displayNameLabel" destination="vcl-Gl-kXl" id="64n-a9-my0"/>
|
<outlet property="displayNameLabel" destination="vcl-Gl-kXl" id="64n-a9-my0"/>
|
||||||
<outlet property="fieldsView" destination="vKC-m1-Sbs" id="FeE-jh-lYH"/>
|
<outlet property="fieldsView" destination="vKC-m1-Sbs" id="FeE-jh-lYH"/>
|
||||||
<outlet property="followsYouLabel" destination="UF8-nI-KVj" id="dTe-DQ-eJV"/>
|
|
||||||
<outlet property="headerImageView" destination="dgG-dR-lSv" id="HXT-v4-2iX"/>
|
<outlet property="headerImageView" destination="dgG-dR-lSv" id="HXT-v4-2iX"/>
|
||||||
<outlet property="lockImageView" destination="KNY-GD-beC" id="9EJ-iM-Eos"/>
|
<outlet property="lockImageView" destination="KNY-GD-beC" id="9EJ-iM-Eos"/>
|
||||||
<outlet property="moreButton" destination="bRJ-Xf-kc9" id="zIN-pz-L7y"/>
|
<outlet property="moreButton" destination="bRJ-Xf-kc9" id="zIN-pz-L7y"/>
|
||||||
<outlet property="noteTextView" destination="1O8-2P-Gbf" id="yss-zZ-uQ5"/>
|
<outlet property="noteTextView" destination="1O8-2P-Gbf" id="yss-zZ-uQ5"/>
|
||||||
<outlet property="pagesSegmentedControl" destination="n1M-vM-Cj0" id="TCU-ku-YZN"/>
|
<outlet property="pagesSegmentedControl" destination="n1M-vM-Cj0" id="TCU-ku-YZN"/>
|
||||||
|
<outlet property="relationshipLabel" destination="UF8-nI-KVj" id="dTe-DQ-eJV"/>
|
||||||
<outlet property="usernameLabel" destination="1C3-Pd-QiL" id="57b-LQ-3pM"/>
|
<outlet property="usernameLabel" destination="1C3-Pd-QiL" id="57b-LQ-3pM"/>
|
||||||
</connections>
|
</connections>
|
||||||
<point key="canvasLocation" x="-590" y="117"/>
|
<point key="canvasLocation" x="-590" y="117"/>
|
||||||
|
|
Loading…
Reference in New Issue