refactored PreDefinedFocusedelement func
This commit is contained in:
parent
c1392f4253
commit
44d2aa630e
@ -171,12 +171,17 @@ open class AccessibilityHandler {
|
|||||||
open func canPostAccessbilityNotification(for viewController: UIViewController) -> Bool { true }
|
open func canPostAccessbilityNotification(for viewController: UIViewController) -> Bool { true }
|
||||||
|
|
||||||
func getPreDefinedFocusedElementIfAny() -> UIView? {
|
func getPreDefinedFocusedElementIfAny() -> UIView? {
|
||||||
guard let accessibilityId, let models: [any Identifiable] = (delegate?.delegateObject?() as? MVMCoreUIDelegateObject)?.moleculeDelegate?.getRootMolecules().allMoleculesOfType() else { return nil }
|
guard let accessibilityId else { return nil }
|
||||||
guard !models.isEmpty,
|
var modelElement: MoleculeModelProtocol?
|
||||||
let model = (models.filter { ($0.id as? String) == accessibilityId }).first else { return nil }
|
((delegate?.delegateObject?() as? MVMCoreUIDelegateObject)?.moleculeDelegate)?.getRootMolecules().depthFirstTraverse(options: .leafNodesOnly, depth: 0) { index, model, stop in
|
||||||
|
if model.id == accessibilityId {
|
||||||
|
modelElement = model
|
||||||
|
stop = true
|
||||||
|
}
|
||||||
|
}
|
||||||
return (delegate as? UIViewController)?.view?.getMoleculeViews { (subView: MoleculeViewProtocol) in
|
return (delegate as? UIViewController)?.view?.getMoleculeViews { (subView: MoleculeViewProtocol) in
|
||||||
guard let moleculeModel = (subView as? MoleculeViewModelProtocol)?.moleculeModel as? (any Identifiable),
|
guard let modelElement, let moleculeModel = (subView as? MoleculeViewModelProtocol)?.moleculeModel,
|
||||||
(moleculeModel.id as? String) == (model.id as? String) else {
|
moleculeModel.id == modelElement.id else {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user