parent
2d45fbbd91
commit
38eea44a8b
|
@ -42,6 +42,8 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
|
||||
view.isHidden = true
|
||||
|
||||
view.accessibilityViewIsModal = true
|
||||
|
||||
view.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(handleTap(_:))))
|
||||
accountsStack.addGestureRecognizer(UIPanGestureRecognizer(target: self, action: #selector(handlePan(_:))))
|
||||
}
|
||||
|
@ -67,10 +69,16 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
|
||||
view.isHidden = false
|
||||
|
||||
func completion() {
|
||||
UIAccessibility.post(notification: .screenChanged, argument: accountViews.first)
|
||||
}
|
||||
|
||||
if UIAccessibility.prefersCrossFadeTransitions {
|
||||
view.alpha = 0
|
||||
UIView.animate(withDuration: 0.2, delay: 0, options: [.curveEaseInOut, .allowUserInteraction]) {
|
||||
self.view.alpha = 1
|
||||
} completion: { _ in
|
||||
completion()
|
||||
}
|
||||
} else {
|
||||
let totalDuration: TimeInterval = 0.5
|
||||
|
@ -95,6 +103,8 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
accountView.transform = .identity
|
||||
}
|
||||
}
|
||||
} completion: { _ in
|
||||
completion()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +124,8 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
self.view.isHidden = true
|
||||
completion?()
|
||||
self.view.removeFromSuperview()
|
||||
|
||||
UIAccessibility.post(notification: .screenChanged, argument: nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -271,6 +283,14 @@ class FastAccountSwitcherViewController: UIViewController {
|
|||
|
||||
super.touchesBegan(touches, with: event)
|
||||
}
|
||||
|
||||
override func accessibilityPerformEscape() -> Bool {
|
||||
guard !view.isHidden else {
|
||||
return false
|
||||
}
|
||||
hide()
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,8 @@ class FastSwitchingAccountView: UIView {
|
|||
}
|
||||
|
||||
updateLabelColors()
|
||||
|
||||
isAccessibilityElement = true
|
||||
}
|
||||
|
||||
private func setupAccount(account: LocalData.UserAccountInfo) {
|
||||
|
@ -134,12 +136,16 @@ class FastSwitchingAccountView: UIView {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
accessibilityLabel = "\(account.username!)@\(account.instanceURL.host!)"
|
||||
}
|
||||
|
||||
private func setupPlaceholder() {
|
||||
usernameLabel.text = "Add Account"
|
||||
instanceLabel.isHidden = true
|
||||
avatarImageView.image = UIImage(systemName: "plus")
|
||||
|
||||
accessibilityLabel = "Add Account"
|
||||
}
|
||||
|
||||
private func updateLabelColors() {
|
||||
|
|
Loading…
Reference in New Issue