Follows you indicator

This commit is contained in:
Justin Mazzocchi 2021-01-31 10:43:37 -08:00
parent 501b83de80
commit aad592e01a
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
4 changed files with 61 additions and 0 deletions

View file

@ -14,6 +14,7 @@
"account.following" = "Following"; "account.following" = "Following";
"account.following-count" = "%ld Following"; "account.following-count" = "%ld Following";
"account.followed-by-%@" = "Followed by %@"; "account.followed-by-%@" = "Followed by %@";
"account.follows-you" = "Follows you";
"account.hide-reblogs" = "Hide boosts"; "account.hide-reblogs" = "Hide boosts";
"account.mute" = "Mute"; "account.mute" = "Mute";
"account.request" = "Request"; "account.request" = "Request";

View file

@ -58,6 +58,7 @@
D03D87F425C23C44004DCBB2 /* SecondaryNavigationTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03D87F325C23C44004DCBB2 /* SecondaryNavigationTitleView.swift */; }; D03D87F425C23C44004DCBB2 /* SecondaryNavigationTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03D87F325C23C44004DCBB2 /* SecondaryNavigationTitleView.swift */; };
D0477F1525C68BAC005C5368 /* PrefetchRequestModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477F1425C68BAC005C5368 /* PrefetchRequestModifier.swift */; }; D0477F1525C68BAC005C5368 /* PrefetchRequestModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477F1425C68BAC005C5368 /* PrefetchRequestModifier.swift */; };
D0477F2C25C6EBAD005C5368 /* OpenInSafariActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477F2B25C6EBAD005C5368 /* OpenInSafariActivity.swift */; }; D0477F2C25C6EBAD005C5368 /* OpenInSafariActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477F2B25C6EBAD005C5368 /* OpenInSafariActivity.swift */; };
D0477F4625C72E50005C5368 /* FollowsYouLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0477F4525C72E50005C5368 /* FollowsYouLabel.swift */; };
D04F9E8E259E9C950081B0C9 /* ViewModels in Frameworks */ = {isa = PBXBuildFile; productRef = D04F9E8D259E9C950081B0C9 /* ViewModels */; }; D04F9E8E259E9C950081B0C9 /* ViewModels in Frameworks */ = {isa = PBXBuildFile; productRef = D04F9E8D259E9C950081B0C9 /* ViewModels */; };
D05936CF25A8D79800754FDF /* EditAttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05936CE25A8D79800754FDF /* EditAttachmentViewController.swift */; }; D05936CF25A8D79800754FDF /* EditAttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05936CE25A8D79800754FDF /* EditAttachmentViewController.swift */; };
D05936D025A8D79800754FDF /* EditAttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05936CE25A8D79800754FDF /* EditAttachmentViewController.swift */; }; D05936D025A8D79800754FDF /* EditAttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D05936CE25A8D79800754FDF /* EditAttachmentViewController.swift */; };
@ -255,6 +256,7 @@
D03D87F325C23C44004DCBB2 /* SecondaryNavigationTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondaryNavigationTitleView.swift; sourceTree = "<group>"; }; D03D87F325C23C44004DCBB2 /* SecondaryNavigationTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondaryNavigationTitleView.swift; sourceTree = "<group>"; };
D0477F1425C68BAC005C5368 /* PrefetchRequestModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefetchRequestModifier.swift; sourceTree = "<group>"; }; D0477F1425C68BAC005C5368 /* PrefetchRequestModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrefetchRequestModifier.swift; sourceTree = "<group>"; };
D0477F2B25C6EBAD005C5368 /* OpenInSafariActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenInSafariActivity.swift; sourceTree = "<group>"; }; D0477F2B25C6EBAD005C5368 /* OpenInSafariActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenInSafariActivity.swift; sourceTree = "<group>"; };
D0477F4525C72E50005C5368 /* FollowsYouLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FollowsYouLabel.swift; sourceTree = "<group>"; };
D047FA8C24C3E21200AF17C5 /* Metatext.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Metatext.app; sourceTree = BUILT_PRODUCTS_DIR; }; D047FA8C24C3E21200AF17C5 /* Metatext.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Metatext.app; sourceTree = BUILT_PRODUCTS_DIR; };
D05936CE25A8D79800754FDF /* EditAttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditAttachmentViewController.swift; sourceTree = "<group>"; }; D05936CE25A8D79800754FDF /* EditAttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditAttachmentViewController.swift; sourceTree = "<group>"; };
D05936DD25A937EC00754FDF /* EditThumbnailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditThumbnailView.swift; sourceTree = "<group>"; }; D05936DD25A937EC00754FDF /* EditThumbnailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditThumbnailView.swift; sourceTree = "<group>"; };
@ -434,6 +436,7 @@
D05936DD25A937EC00754FDF /* EditThumbnailView.swift */, D05936DD25A937EC00754FDF /* EditThumbnailView.swift */,
D07EC7FC25B16994006DF726 /* EmojiCategoryHeaderView.swift */, D07EC7FC25B16994006DF726 /* EmojiCategoryHeaderView.swift */,
D0DDA77E25C6058300FA0F91 /* ExploreSectionHeaderView.swift */, D0DDA77E25C6058300FA0F91 /* ExploreSectionHeaderView.swift */,
D0477F4525C72E50005C5368 /* FollowsYouLabel.swift */,
D0D2AC6625BD0484003D5DF2 /* LineChartView.swift */, D0D2AC6625BD0484003D5DF2 /* LineChartView.swift */,
D0BEB1F624F9A84B001B0F04 /* LoadingTableFooterView.swift */, D0BEB1F624F9A84B001B0F04 /* LoadingTableFooterView.swift */,
D05936FE25AA94EA00754FDF /* MarkAttachmentsSensitiveView.swift */, D05936FE25AA94EA00754FDF /* MarkAttachmentsSensitiveView.swift */,
@ -1071,6 +1074,7 @@
D0E1F583251F13EC00D45315 /* WebfingerIndicatorView.swift in Sources */, D0E1F583251F13EC00D45315 /* WebfingerIndicatorView.swift in Sources */,
D0BEB20524FA1107001B0F04 /* FiltersView.swift in Sources */, D0BEB20524FA1107001B0F04 /* FiltersView.swift in Sources */,
D0DDA76B25C5F20800FA0F91 /* ExploreDataSource.swift in Sources */, D0DDA76B25C5F20800FA0F91 /* ExploreDataSource.swift in Sources */,
D0477F4625C72E50005C5368 /* FollowsYouLabel.swift in Sources */,
D035F88725B8016000DC75ED /* NavigationViewModel+Extensions.swift in Sources */, D035F88725B8016000DC75ED /* NavigationViewModel+Extensions.swift in Sources */,
D0C7D49B24F7616A001EBDBB /* PreferencesView.swift in Sources */, D0C7D49B24F7616A001EBDBB /* PreferencesView.swift in Sources */,
D09D972225C65682007E6394 /* SeparatorConfiguredCollectionViewListCell.swift in Sources */, D09D972225C65682007E6394 /* SeparatorConfiguredCollectionViewListCell.swift in Sources */,

View file

@ -18,6 +18,7 @@ final class AccountHeaderView: UIView {
let accountStackView = UIStackView() let accountStackView = UIStackView()
let accountLabel = UILabel() let accountLabel = UILabel()
let lockedImageView = UIImageView() let lockedImageView = UIImageView()
let followsYouLabel = FollowsYouLabel()
let fieldsStackView = UIStackView() let fieldsStackView = UIStackView()
let noteTextView = TouchFallthroughTextView() let noteTextView = TouchFallthroughTextView()
let followStackView = UIStackView() let followStackView = UIStackView()
@ -39,6 +40,7 @@ final class AccountHeaderView: UIView {
avatarImageView.tag = accountViewModel.avatarURL(profile: true).hashValue avatarImageView.tag = accountViewModel.avatarURL(profile: true).hashValue
if !accountViewModel.isSelf, let relationship = accountViewModel.relationship { if !accountViewModel.isSelf, let relationship = accountViewModel.relationship {
followsYouLabel.isHidden = !relationship.followedBy
followButton.setTitle( followButton.setTitle(
NSLocalizedString( NSLocalizedString(
accountViewModel.isLocked ? "account.request" : "account.follow", accountViewModel.isLocked ? "account.request" : "account.follow",
@ -267,6 +269,7 @@ private extension AccountHeaderView {
displayNameLabel.adjustsFontForContentSizeCategory = true displayNameLabel.adjustsFontForContentSizeCategory = true
baseStackView.addArrangedSubview(accountStackView) baseStackView.addArrangedSubview(accountStackView)
accountStackView.spacing = .compactSpacing
accountStackView.addArrangedSubview(accountLabel) accountStackView.addArrangedSubview(accountLabel)
accountLabel.numberOfLines = 0 accountLabel.numberOfLines = 0
@ -283,6 +286,10 @@ private extension AccountHeaderView {
lockedImageView.tintColor = .secondaryLabel lockedImageView.tintColor = .secondaryLabel
lockedImageView.contentMode = .scaleAspectFit lockedImageView.contentMode = .scaleAspectFit
accountStackView.addArrangedSubview(followsYouLabel)
followsYouLabel.text = NSLocalizedString("account.follows-you", comment: "")
followsYouLabel.isHidden = true
accountStackView.addArrangedSubview(UIView()) accountStackView.addArrangedSubview(UIView())
baseStackView.addArrangedSubview(fieldsStackView) baseStackView.addArrangedSubview(fieldsStackView)

View file

@ -0,0 +1,49 @@
// Copyright © 2021 Metabolist. All rights reserved.
import UIKit
final class FollowsYouLabel: UILabel {
override init(frame: CGRect) {
super.init(frame: frame)
initialSetup()
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
layer.cornerRadius = inset
invalidateIntrinsicContentSize()
}
override func drawText(in rect: CGRect) {
super.drawText(in: rect.inset(by: .init(top: 0, left: inset, bottom: 0, right: inset)))
}
override var intrinsicContentSize: CGSize {
var size = super.intrinsicContentSize
size.width += inset * 2
return size
}
}
private extension FollowsYouLabel {
var inset: CGFloat { bounds.height / 2 }
func initialSetup() {
backgroundColor = .tertiarySystemBackground
textColor = .secondaryLabel
font = UIFont.preferredFont(forTextStyle: .footnote)
adjustsFontForContentSizeCategory = true
setContentHuggingPriority(.required, for: .horizontal)
setContentCompressionResistancePriority(.required, for: .horizontal)
clipsToBounds = true
}
}