feat: make tabBar avatar button border highlighted when selected
This commit is contained in:
parent
1cbc385253
commit
868e86e077
|
@ -252,6 +252,14 @@ extension MainTabBarController {
|
|||
tabBarLongPressGestureRecognizer.addTarget(self, action: #selector(MainTabBarController.tabBarLongPressGestureRecognizerHandler(_:)))
|
||||
tabBar.addGestureRecognizer(tabBarLongPressGestureRecognizer)
|
||||
|
||||
currentTab
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] tab in
|
||||
guard let self = self else { return }
|
||||
self.updateAvatarButtonAppearance()
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
|
||||
updateTabBarDisplay()
|
||||
|
||||
#if DEBUG
|
||||
|
@ -269,6 +277,7 @@ extension MainTabBarController {
|
|||
super.traitCollectionDidChange(previousTraitCollection)
|
||||
|
||||
updateTabBarDisplay()
|
||||
updateAvatarButtonAppearance()
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -340,6 +349,11 @@ extension MainTabBarController {
|
|||
self.avatarButton.setContentHuggingPriority(.required - 1, for: .vertical)
|
||||
self.avatarButton.isUserInteractionEnabled = false
|
||||
}
|
||||
|
||||
private func updateAvatarButtonAppearance() {
|
||||
avatarButton.borderColor = currentTab.value == .me ? .label : .systemFill
|
||||
avatarButton.setNeedsLayout()
|
||||
}
|
||||
}
|
||||
|
||||
extension MainTabBarController {
|
||||
|
|
Loading…
Reference in New Issue