chore: Rename accountSwitcherChevron -> accountToggleIndicator
This commit is contained in:
parent
8fd37c8362
commit
533e626094
@ -43,7 +43,7 @@ class MainTabBarController: UITabBarController {
|
|||||||
|
|
||||||
static let avatarButtonSize = CGSize(width: 25, height: 25)
|
static let avatarButtonSize = CGSize(width: 25, height: 25)
|
||||||
let avatarButton = CircleAvatarButton()
|
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
|
@Published var currentTab: Tab = .home
|
||||||
|
|
||||||
@ -507,8 +507,8 @@ extension MainTabBarController {
|
|||||||
}
|
}
|
||||||
anchorImageView.alpha = 0
|
anchorImageView.alpha = 0
|
||||||
|
|
||||||
accountSwitcherChevron.translatesAutoresizingMaskIntoConstraints = false
|
accountToggleIndicator.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.addSubview(accountSwitcherChevron)
|
view.addSubview(accountToggleIndicator)
|
||||||
|
|
||||||
self.avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
self.avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
view.addSubview(self.avatarButton)
|
view.addSubview(self.avatarButton)
|
||||||
@ -517,10 +517,10 @@ extension MainTabBarController {
|
|||||||
self.avatarButton.centerYAnchor.constraint(equalTo: anchorImageView.centerYAnchor),
|
self.avatarButton.centerYAnchor.constraint(equalTo: anchorImageView.centerYAnchor),
|
||||||
self.avatarButton.widthAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.width).priority(.required - 1),
|
self.avatarButton.widthAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.width).priority(.required - 1),
|
||||||
self.avatarButton.heightAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.height).priority(.required - 1),
|
self.avatarButton.heightAnchor.constraint(equalToConstant: MainTabBarController.avatarButtonSize.height).priority(.required - 1),
|
||||||
accountSwitcherChevron.widthAnchor.constraint(equalToConstant: 10),
|
accountToggleIndicator.widthAnchor.constraint(equalToConstant: 10),
|
||||||
accountSwitcherChevron.heightAnchor.constraint(equalToConstant: 18),
|
accountToggleIndicator.heightAnchor.constraint(equalToConstant: 18),
|
||||||
accountSwitcherChevron.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 8),
|
accountToggleIndicator.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 8),
|
||||||
accountSwitcherChevron.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
|
accountToggleIndicator.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
|
||||||
])
|
])
|
||||||
self.avatarButton.setContentHuggingPriority(.required - 1, for: .horizontal)
|
self.avatarButton.setContentHuggingPriority(.required - 1, for: .horizontal)
|
||||||
self.avatarButton.setContentHuggingPriority(.required - 1, for: .vertical)
|
self.avatarButton.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||||
@ -528,7 +528,7 @@ extension MainTabBarController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateAvatarButtonAppearance() {
|
private func updateAvatarButtonAppearance() {
|
||||||
accountSwitcherChevron.tintColor = currentTab == .me ? .label : .secondaryLabel
|
accountToggleIndicator.tintColor = currentTab == .me ? .label : .secondaryLabel
|
||||||
avatarButton.borderColor = currentTab == .me ? .label : .systemFill
|
avatarButton.borderColor = currentTab == .me ? .label : .systemFill
|
||||||
avatarButton.setNeedsLayout()
|
avatarButton.setNeedsLayout()
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ final class SidebarListContentView: UIView, UIContentView {
|
|||||||
button.borderColor = UIColor.label
|
button.borderColor = UIColor.label
|
||||||
return button
|
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!
|
private var currentConfiguration: ContentConfiguration!
|
||||||
var configuration: UIContentConfiguration {
|
var configuration: UIContentConfiguration {
|
||||||
@ -62,8 +62,8 @@ extension SidebarListContentView {
|
|||||||
imageView.heightAnchor.constraint(equalToConstant: 40).priority(.required - 1),
|
imageView.heightAnchor.constraint(equalToConstant: 40).priority(.required - 1),
|
||||||
])
|
])
|
||||||
|
|
||||||
accountSwitcherChevron.translatesAutoresizingMaskIntoConstraints = false
|
accountToggleIndicator.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(accountSwitcherChevron)
|
addSubview(accountToggleIndicator)
|
||||||
|
|
||||||
avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
avatarButton.translatesAutoresizingMaskIntoConstraints = false
|
||||||
addSubview(avatarButton)
|
addSubview(avatarButton)
|
||||||
@ -72,10 +72,10 @@ extension SidebarListContentView {
|
|||||||
avatarButton.centerYAnchor.constraint(equalTo: imageView.centerYAnchor),
|
avatarButton.centerYAnchor.constraint(equalTo: imageView.centerYAnchor),
|
||||||
avatarButton.widthAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: 1.0).priority(.required - 2),
|
avatarButton.widthAnchor.constraint(equalTo: imageView.widthAnchor, multiplier: 1.0).priority(.required - 2),
|
||||||
avatarButton.heightAnchor.constraint(equalTo: imageView.heightAnchor, multiplier: 1.0).priority(.required - 2),
|
avatarButton.heightAnchor.constraint(equalTo: imageView.heightAnchor, multiplier: 1.0).priority(.required - 2),
|
||||||
accountSwitcherChevron.widthAnchor.constraint(equalToConstant: 12),
|
accountToggleIndicator.widthAnchor.constraint(equalToConstant: 12),
|
||||||
accountSwitcherChevron.heightAnchor.constraint(equalToConstant: 22),
|
accountToggleIndicator.heightAnchor.constraint(equalToConstant: 22),
|
||||||
accountSwitcherChevron.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 4),
|
accountToggleIndicator.leadingAnchor.constraint(equalTo: avatarButton.trailingAnchor, constant: 4),
|
||||||
accountSwitcherChevron.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
|
accountToggleIndicator.centerYAnchor.constraint(equalTo: avatarButton.centerYAnchor)
|
||||||
])
|
])
|
||||||
avatarButton.setContentHuggingPriority(.defaultLow - 10, for: .vertical)
|
avatarButton.setContentHuggingPriority(.defaultLow - 10, for: .vertical)
|
||||||
avatarButton.setContentHuggingPriority(.defaultLow - 10, for: .horizontal)
|
avatarButton.setContentHuggingPriority(.defaultLow - 10, for: .horizontal)
|
||||||
@ -104,8 +104,8 @@ extension SidebarListContentView {
|
|||||||
imageView.isHidden = item.imageURL != nil
|
imageView.isHidden = item.imageURL != nil
|
||||||
avatarButton.isHidden = item.imageURL == nil
|
avatarButton.isHidden = item.imageURL == nil
|
||||||
imageView.image = item.isActive ? item.activeImage.withRenderingMode(.alwaysTemplate) : item.image.withRenderingMode(.alwaysTemplate)
|
imageView.image = item.isActive ? item.activeImage.withRenderingMode(.alwaysTemplate) : item.image.withRenderingMode(.alwaysTemplate)
|
||||||
accountSwitcherChevron.isHidden = !item.showAccountSwitcher
|
accountToggleIndicator.isHidden = !item.showAccountSwitcher
|
||||||
accountSwitcherChevron.tintColor = item.isActive ? .label : .secondaryLabel
|
accountToggleIndicator.tintColor = item.isActive ? .label : .secondaryLabel
|
||||||
avatarButton.avatarImageView.setImage(
|
avatarButton.avatarImageView.setImage(
|
||||||
url: item.imageURL,
|
url: item.imageURL,
|
||||||
placeholder: avatarButton.avatarImageView.image ?? .placeholder(color: .systemFill), // reuse to avoid blink
|
placeholder: avatarButton.avatarImageView.image ?? .placeholder(color: .systemFill), // reuse to avoid blink
|
||||||
|
Loading…
x
Reference in New Issue
Block a user