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