Addressed review comments and removed model based traits for button
This commit is contained in:
parent
521eaa7c15
commit
67dfe37e97
@ -59,7 +59,7 @@ open class AccessibilityHandler {
|
||||
public var anyCancellable: Set<AnyCancellable> = []
|
||||
public weak var delegate: MVMCoreViewControllerProtocol? { delegateObject?.moleculeDelegate as? MVMCoreViewControllerProtocol }
|
||||
public weak var delegateObject: MVMCoreUIDelegateObject?
|
||||
private var hasTopNotificationInPage: Bool { delegate?.loadObject??.responseJSON?.optionalDictionaryForKey("TopNotification") != nil || delegate?.loadObject??.responseInfoMap?.optionalStringForKey("userMessage") != nil }
|
||||
private var hasTopNotificationInPage: Bool { delegate?.loadObject??.responseJSON?.optionalDictionaryForKey("TopNotification") != nil || delegate?.loadObject??.responseInfoMap?.optionalStringForKey("messageStyle") != nil }
|
||||
private let accessibilityOperationQueue: OperationQueue = {
|
||||
let queue = OperationQueue()
|
||||
queue.maxConcurrentOperationCount = 1
|
||||
|
||||
@ -125,7 +125,7 @@ class RotorHandler {
|
||||
|
||||
private func getRotorElementsFrom(template: (MVMCoreViewControllerProtocol & UIViewController)?, type: RotorType) -> [Any]? {
|
||||
guard let template = template as? (RotorViewElementsProtocol & MVMCoreViewControllerProtocol & UIViewController) else {
|
||||
return MVMCoreUIUtility.findViews(by: UIView.self, views: [template?.view].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any] //BAU Pages
|
||||
return MVMCoreUIUtility.findViews(by: UIView.self, views: [template?.view].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any]
|
||||
}
|
||||
let topViewRotorElements = MVMCoreUIUtility.findViews(by: UIView.self, views: [template.topView].compactMap { $0 }).filter { $0.accessibilityTraits.contains(type.trait) } as [Any]
|
||||
var reusableViewRotorElements: [Any] = []
|
||||
@ -163,19 +163,18 @@ class RotorHandler {
|
||||
private func createRotor(for type: RotorType) -> UIAccessibilityCustomRotor? {
|
||||
return type.getUIAccessibilityCustomRotor { [weak self] predicate in
|
||||
guard let self, let elements = self.rotorElements[type] else { return UIAccessibilityCustomRotorItemResult() }
|
||||
var rotorIndex = self.rotorIndexes[type] ?? 0
|
||||
var rotorIndex = self.rotorIndexes[type] ?? -1
|
||||
if predicate.searchDirection == .next {
|
||||
rotorIndex += 1
|
||||
if rotorIndex > elements.count {
|
||||
rotorIndex = 1
|
||||
if rotorIndex + 1 < elements.count {
|
||||
rotorIndex += 1
|
||||
}
|
||||
} else {
|
||||
rotorIndex -= 1
|
||||
if rotorIndex <= 0 {
|
||||
rotorIndex = elements.count
|
||||
if rotorIndex > 0 {
|
||||
rotorIndex -= 1
|
||||
}
|
||||
}
|
||||
var rotorElement = elements[rotorIndex - 1]
|
||||
guard rotorIndex >= 0 else { return UIAccessibilityCustomRotorItemResult() }
|
||||
var rotorElement = elements[rotorIndex]
|
||||
if let element = rotorElement as? RotorElement,
|
||||
let controller = self.delegate as? RotorListTypeDelegateProtocol {
|
||||
controller.scrollToRow(at: element.indexPath, at: .middle, animated: false)
|
||||
|
||||
@ -35,7 +35,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
||||
public var size: Styler.Button.Size? = .standard
|
||||
public var groupName: String = ""
|
||||
public var inverted: Bool = false
|
||||
public var accessibilityTraits: UIAccessibilityTraits?
|
||||
|
||||
public lazy var enabledColors: FacadeElements = (fill: enabled_fillColor(),
|
||||
text: enabled_textColor(),
|
||||
@ -196,7 +195,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
||||
case disabledTextColor
|
||||
case disabledBorderColor
|
||||
case width
|
||||
case accessibilityTraits
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -209,7 +207,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
||||
id = try typeContainer.decodeIfPresent(String.self, forKey: .id) ?? UUID().uuidString
|
||||
accessibilityIdentifier = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityIdentifier)
|
||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
|
||||
|
||||
@ -107,10 +107,6 @@ public typealias ButtonAction = (Button) -> ()
|
||||
isEnabled = model.enabled
|
||||
}
|
||||
|
||||
if let accessibilityTraits = model.accessibilityTraits {
|
||||
self.accessibilityTraits = accessibilityTraits
|
||||
}
|
||||
|
||||
guard let model = model as? ButtonModelProtocol else { return }
|
||||
|
||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user