Voice Over Improvements

This commit is contained in:
Ilya Laktyushin
2021-02-12 21:12:53 +04:00
parent 660234168d
commit 0ac2026d5a
14 changed files with 3271 additions and 3199 deletions

View File

@@ -113,6 +113,8 @@ class ItemListRecentSessionItemNode: ItemListRevealOptionsItemNode {
private let locationNode: TextNode
private let labelNode: TextNode
private let activateArea: AccessibilityAreaNode
private var layoutParams: (ItemListRecentSessionItem, ListViewItemLayoutParams, ItemListNeighbors)?
private var editableControlNode: ItemListEditableControlNode?
@@ -152,12 +154,16 @@ class ItemListRecentSessionItemNode: ItemListRevealOptionsItemNode {
self.highlightedBackgroundNode = ASDisplayNode()
self.highlightedBackgroundNode.isLayerBacked = true
self.activateArea = AccessibilityAreaNode()
super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
self.addSubnode(self.titleNode)
self.addSubnode(self.appNode)
self.addSubnode(self.locationNode)
self.addSubnode(self.labelNode)
self.addSubnode(self.activateArea)
}
func asyncLayout() -> (_ item: ItemListRecentSessionItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, (Bool) -> Void) {
@@ -268,6 +274,33 @@ class ItemListRecentSessionItemNode: ItemListRevealOptionsItemNode {
if let strongSelf = self {
strongSelf.layoutParams = (item, params, neighbors)
strongSelf.activateArea.frame = CGRect(origin: CGPoint(x: params.leftInset, y: 0.0), size: CGSize(width: params.width - params.leftInset - params.rightInset, height: layout.contentSize.height))
var label = ""
if item.session.isCurrent {
label = item.presentationData.strings.VoiceOver_AuthSessions_CurrentSession
label += ", "
}
label += titleAttributedString?.string ?? ""
strongSelf.activateArea.accessibilityLabel = label
var value = ""
if let string = appAttributedString?.string {
value += string
}
if let string = locationAttributedString?.string {
if !value.isEmpty {
value += "\n"
}
value += string
}
if item.enabled {
strongSelf.activateArea.accessibilityTraits = []
} else {
strongSelf.activateArea.accessibilityTraits = .notEnabled
}
if let _ = updatedTheme {
strongSelf.topStripeNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor
strongSelf.bottomStripeNode.backgroundColor = item.presentationData.theme.list.itemBlocksSeparatorColor