1
0
mirror of https://github.com/mastodon/mastodon-ios.git synced 2024-12-22 06:19:03 +01:00

chore: Rename accountSwitcherChevron -> accountToggleIndicator

This commit is contained in:
Marcus Kida 2022-11-15 13:54:44 +01:00
parent 8fd37c8362
commit 533e626094
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
2 changed files with 17 additions and 17 deletions

View File

@ -43,7 +43,7 @@ class MainTabBarController: UITabBarController {
static let avatarButtonSize = CGSize(width: 25, height: 25)
let avatarButton = CircleAvatarButton()
let accountSwitcherChevron = UIImageView(image: UIImage(systemName: "chevron.up.chevron.down"))
private let accountToggleIndicator = UIImageView(image: UIImage(systemName: "chevron.up.chevron.down"))
@Published var currentTab: Tab = .home
@ -507,8 +507,8 @@ extension MainTabBarController {
}
anchorImageView.alpha = 0
accountSwitcherChevron.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(accountSwitcherChevron)
accountToggleIndicator.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(accountToggleIndicator)
self.avatarButton.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(self.avatarButton)
@ -517,10 +517,10 @@ extension MainTabBarController {
self.avatarButton.centerYAnchor.constraint(equalTo: anchorImageView.centerYAnchor),
self.avatarButton.widthAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.width).priority(.required - 1),
self.avatarButton.heightAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.height).priority(.required - 1),
accountSwitcherChevron.widthAnchor.constraint(equalToConstant: 10),
accountSwitcherChevron.heightAnchor.constraint(equalToConstant: 18),
accountSwitcherChevron.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 8),
accountSwitcherChevron.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
accountToggleIndicator.widthAnchor.constraint(equalToConstant: 10),
accountToggleIndicator.heightAnchor.constraint(equalToConstant: 18),
accountToggleIndicator.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 8),
accountToggleIndicator.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
])
self.avatarButton.setContentHuggingPriority(.required - 1, for: .horizontal)
self.avatarButton.setContentHuggingPriority(.required - 1, for: .vertical)
@ -528,7 +528,7 @@ extension MainTabBarController {
}
private func updateAvatarButtonAppearance() {
accountSwitcherChevron.tintColor = currentTab == .me ? .label : .secondaryLabel
accountToggleIndicator.tintColor = currentTab == .me ? .label : .secondaryLabel
avatarButton.borderColor = currentTab == .me ? .label : .systemFill
avatarButton.setNeedsLayout()
}

View File

@ -23,7 +23,7 @@ final class SidebarListContentView: UIView, UIContentView {
button.borderColor = UIColor.label
return button
}()
let accountSwitcherChevron = UIImageView(image: UIImage(systemName: "chevron.up.chevron.down"))
private let accountToggleIndicator = UIImageView(image: UIImage(systemName: "chevron.up.chevron.down"))
private var currentConfiguration: ContentConfiguration!
var configuration: UIContentConfiguration {
@ -62,8 +62,8 @@ extension SidebarListContentView {
imageView.heightAnchor.constraint(equalToConstant: 40).priority(.required - 1),
])
accountSwitcherChevron.translatesAutoresizingMaskIntoConstraints = false
addSubview(accountSwitcherChevron)
accountToggleIndicator.translatesAutoresizingMaskIntoConstraints = false
addSubview(accountToggleIndicator)
avatarButton.translatesAutoresizingMaskIntoConstraints = false
addSubview(avatarButton)
@ -72,10 +72,10 @@ extension SidebarListContentView {
avatarButton.centerYAnchor.constraint(equalTo: imageView.centerYAnchor),
avatarButton.widthAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: 1.0).priority(.required - 2),
avatarButton.heightAnchor.constraint(equalTo: imageView.heightAnchor, multiplier: 1.0).priority(.required - 2),
accountSwitcherChevron.widthAnchor.constraint(equalToConstant: 12),
accountSwitcherChevron.heightAnchor.constraint(equalToConstant: 22),
accountSwitcherChevron.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 4),
accountSwitcherChevron.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
accountToggleIndicator.widthAnchor.constraint(equalToConstant: 12),
accountToggleIndicator.heightAnchor.constraint(equalToConstant: 22),
accountToggleIndicator.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 4),
accountToggleIndicator.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
])
avatarButton.setContentHuggingPriority(.defaultLow - 10, for: .vertical)
avatarButton.setContentHuggingPriority(.defaultLow - 10, for: .horizontal)
@ -104,8 +104,8 @@ extension SidebarListContentView {
imageView.isHidden = item.imageURL != nil
avatarButton.isHidden = item.imageURL == nil
imageView.image = item.isActive ? item.activeImage.withRenderingMode(.alwaysTemplate) : item.image.withRenderingMode(.alwaysTemplate)
accountSwitcherChevron.isHidden = !item.showAccountSwitcher
accountSwitcherChevron.tintColor = item.isActive ? .label : .secondaryLabel
accountToggleIndicator.isHidden = !item.showAccountSwitcher
accountToggleIndicator.tintColor = item.isActive ? .label : .secondaryLabel
avatarButton.avatarImageView.setImage(
url: item.imageURL,
placeholder: avatarButton.avatarImageView.image ?? .placeholder(color: .systemFill), // reuse to avoid blink