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