added review comments

This commit is contained in:
Krishna Kishore Bandaru 2023-11-02 21:40:01 +05:30
parent df2fa3405b
commit 9c43649cce

View File

@ -53,12 +53,14 @@ open class AccessibilityHandler {
guard let shared = CoreUIObject.sharedInstance()?.accessibilityHandler else { return nil }
return MVMCoreActionUtility.fatalClassCheck(object: shared)
}
//TODO: Revisit to avoid state properties to store in handler.
public var accessibilityId: String? ///This property is used to post accessibility to the UIElement mapped to this accessibilityId
public var previousAccessiblityElement: Any? ///This property is capture accessiblity element
public var anyCancellable: Set<AnyCancellable> = []
public weak var delegate: MVMCoreViewControllerProtocol? { delegateObject?.loadDelegate as? MVMCoreViewControllerProtocol }
public weak var currentController: UIViewController? { MVMCoreUIUtility.getCurrentVisibleController() }
public var delegateObject: MVMCoreUIDelegateObject?
private var hasTopNotificationInPage: Bool { delegate?.loadObject??.responseJSON?.optionalDictionaryForKey("TopNotification") != nil || delegate?.loadObject??.responseInfoMap?.optionalStringForKey("messageStyle") != nil }
//TODO: Revisit to identify the page has top notification or not.
private var hasTopNotificationInPage: Bool { (currentController as? MVMCoreViewControllerProtocol)?.loadObject??.responseJSON?.optionalDictionaryForKey("TopNotification") != nil || (currentController as? MVMCoreViewControllerProtocol)?.loadObject??.responseInfoMap?.optionalStringForKey("messageStyle") != nil }
private let accessibilityOperationQueue: OperationQueue = {
let queue = OperationQueue()
queue.maxConcurrentOperationCount = 1
@ -103,7 +105,7 @@ open class AccessibilityHandler {
If navigationBar is hidden then we are returning nil so that voice over will shift to the first interactive element.
*/
open func getFirstFocusedElementOnScreen() -> Any? {
((delegate as? PageProtocol)?.pageModel?.navigationBar?.hidden ?? false) ? nil : (delegate as? UIViewController)?.navigationController?.navigationBar
((currentController as? PageProtocol)?.pageModel?.navigationBar?.hidden ?? false) ? nil : currentController?.navigationController?.navigationBar
}
/**
@ -115,7 +117,7 @@ open class AccessibilityHandler {
This method is used to identify the UIElement that is mapped to accessibilityId from server response.
*/
func getPreDefinedFocusedElementIfAny() -> UIView? {
guard let accessibilityId, let view = (delegate as? UIViewController)?.view else { return nil }
guard let accessibilityId, let view = currentController?.view else { return nil }
return MVMCoreUIUtility.findViews(by: MoleculeViewProtocol.self, views: [view]).first {
$0.model?.id == accessibilityId
}