Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui into feature/Headers_H2_Buttons
This commit is contained in:
commit
c9148aabd5
@ -20,7 +20,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override var isSelected: Bool {
|
@objc public override var isSelected: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
radioModel?.state = isSelected
|
radioModel?.state = isSelected
|
||||||
updateAccessibilityLabel()
|
updateAccessibilityLabel()
|
||||||
@ -127,7 +127,7 @@ import UIKit
|
|||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
if let state = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") {
|
if let state = MVMCoreUIUtility.hardcodedString(withKey: isSelected ? "radio_selected_state" : "radio_not_selected_state") {
|
||||||
accessibilityLabel = String(format: MVMCoreUIUtility.hardcodedString(withKey: "radio_desc_state") ?? "%@%@", "", state)
|
accessibilityLabel = state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -20,9 +20,9 @@ import Foundation
|
|||||||
private var selectedRadioButtonModel: RadioButtonModel?
|
private var selectedRadioButtonModel: RadioButtonModel?
|
||||||
public var baseValue: AnyHashable?
|
public var baseValue: AnyHashable?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func set(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton) {
|
public func set(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton) {
|
||||||
self.fieldKey = radioButtonModel.fieldKey
|
self.fieldKey = radioButtonModel.fieldKey
|
||||||
@ -50,9 +50,8 @@ import Foundation
|
|||||||
public static func setupForRadioButtonGroup(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton, delegateObject: MVMCoreUIDelegateObject?) {
|
public static func setupForRadioButtonGroup(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton, delegateObject: MVMCoreUIDelegateObject?) {
|
||||||
|
|
||||||
guard let groupName = radioButtonModel.fieldKey,
|
guard let groupName = radioButtonModel.fieldKey,
|
||||||
let formValidator = delegateObject?.formHolderDelegate?.formValidator else {
|
let formValidator = delegateObject?.formHolderDelegate?.formValidator
|
||||||
return
|
else { return }
|
||||||
}
|
|
||||||
|
|
||||||
let radioButtonSelectionHelper = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper()
|
let radioButtonSelectionHelper = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper()
|
||||||
radioButtonSelectionHelper.set(radioButtonModel, radioButton)
|
radioButtonSelectionHelper.set(radioButtonModel, radioButton)
|
||||||
@ -61,6 +60,7 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func selected(_ radioButton: RadioButton) {
|
public func selected(_ radioButton: RadioButton) {
|
||||||
|
|
||||||
// Checks because the view could be reused
|
// Checks because the view could be reused
|
||||||
if selectedRadioButton?.radioModel === selectedRadioButtonModel {
|
if selectedRadioButton?.radioModel === selectedRadioButtonModel {
|
||||||
selectedRadioButton?.isSelected = false
|
selectedRadioButton?.isSelected = false
|
||||||
@ -76,6 +76,7 @@ import Foundation
|
|||||||
|
|
||||||
// MARK: - FormValidationFormFieldProtocol
|
// MARK: - FormValidationFormFieldProtocol
|
||||||
extension RadioButtonSelectionHelper {
|
extension RadioButtonSelectionHelper {
|
||||||
|
|
||||||
public func formFieldValue() -> AnyHashable? {
|
public func formFieldValue() -> AnyHashable? {
|
||||||
return selectedRadioButtonModel?.fieldValue
|
return selectedRadioButtonModel?.fieldValue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,11 +14,13 @@ import UIKit
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
let radioButton = RadioButton(frame: .zero)
|
let radioButton = RadioButton()
|
||||||
let leftImage = LoadImageView(pinnedEdges: .all)
|
let leftImage = LoadImageView(pinnedEdges: .all)
|
||||||
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
private var observation: NSKeyValueObservation? = nil
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -46,6 +48,16 @@ import UIKit
|
|||||||
stack.restack()
|
stack.restack()
|
||||||
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
|
||||||
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true)
|
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true)
|
||||||
|
radioButton.isAccessibilityElement = false
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
accessibilityTraits = .button
|
||||||
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
|
||||||
|
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
|
self?.updateAccessibilityLabel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
@ -64,6 +76,7 @@ import UIKit
|
|||||||
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
||||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -71,6 +84,34 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
radioButton.tapAction()
|
radioButton.tapAction()
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button") ?? ""
|
||||||
|
|
||||||
|
radioButton.updateAccessibilityLabel()
|
||||||
|
if let radioButtonLabel = radioButton.accessibilityLabel {
|
||||||
|
message += radioButtonLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let leftImageLabel = leftImage.accessibilityLabel {
|
||||||
|
message += leftImageLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
|
message += bodyLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,19 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listLVRBImg"
|
public static var identifier: String = "listLVRBImg"
|
||||||
public var radioButton: RadioButtonModel
|
public var radioButton: RadioButtonModel
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(radioButton: RadioButtonModel, image: ImageViewModel, eyebrowHeadlineBodyLink:EyebrowHeadlineBodyLinkModel) {
|
public init(radioButton: RadioButtonModel, image: ImageViewModel, eyebrowHeadlineBodyLink:EyebrowHeadlineBodyLinkModel) {
|
||||||
self.radioButton = radioButton
|
self.radioButton = radioButton
|
||||||
self.image = image
|
self.image = image
|
||||||
@ -21,6 +29,10 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func setDefaults() {
|
public override func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
if image.width == nil, image.height == nil {
|
if image.width == nil, image.height == nil {
|
||||||
@ -29,6 +41,10 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case radioButton
|
case radioButton
|
||||||
@ -36,6 +52,10 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo
|
|||||||
case eyebrowHeadlineBodyLink
|
case eyebrowHeadlineBodyLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
|
radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
|
||||||
|
|||||||
@ -14,10 +14,12 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
let radioButton = RadioButton(frame: .zero)
|
let radioButton = RadioButton()
|
||||||
let headlineBody = HeadlineBody()
|
let headlineBody = HeadlineBody()
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
private var observation: NSKeyValueObservation? = nil
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
@ -42,6 +44,15 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
radioButton.isAccessibilityElement = false
|
||||||
|
accessibilityTraits = .button
|
||||||
|
accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "radio_action_hint")
|
||||||
|
updateAccessibilityLabel()
|
||||||
|
|
||||||
|
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
|
self?.updateAccessibilityLabel()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
@ -55,6 +66,7 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
|
|
||||||
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
||||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -64,4 +76,24 @@ open class ListLeftVariableRadioButtonBodyText: TableViewCell {
|
|||||||
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
radioButton.tapAction()
|
radioButton.tapAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = MVMCoreUIUtility.hardcodedString(withKey: "radio_button") ?? ""
|
||||||
|
|
||||||
|
radioButton.updateAccessibilityLabel()
|
||||||
|
if let radioButtonLabel = radioButton.accessibilityLabel {
|
||||||
|
message += radioButtonLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = headlineBody.headlineLabel.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let messageLabel = headlineBody.messageLabel.text {
|
||||||
|
message += messageLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,22 +9,40 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import MVMCore
|
import MVMCore
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class MoleculeListItemModel: ListItemModel, MoleculeModelProtocol {
|
@objcMembers public class MoleculeListItemModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public class var identifier: String {
|
public class var identifier: String {
|
||||||
return "listItem"
|
return "listItem"
|
||||||
}
|
}
|
||||||
|
|
||||||
public var molecule: MoleculeModelProtocol
|
public var molecule: MoleculeModelProtocol
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case molecule
|
case molecule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(with moleculeModel: MoleculeModelProtocol) {
|
public init(with moleculeModel: MoleculeModelProtocol) {
|
||||||
molecule = moleculeModel
|
molecule = moleculeModel
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
||||||
@ -38,4 +56,3 @@ import MVMCore
|
|||||||
try container.encodeModel(molecule, forKey: .molecule)
|
try container.encodeModel(molecule, forKey: .molecule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,8 +10,9 @@ import UIKit
|
|||||||
|
|
||||||
|
|
||||||
@objcMembers open class MoleculeTableViewCell: TableViewCell {
|
@objcMembers open class MoleculeTableViewCell: TableViewCell {
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import UIKit
|
|||||||
|
|
||||||
// This class is only temporarily necessary. Eventually we will have initWithModel instad of just init for moleculeviews, which will remove this need.
|
// This class is only temporarily necessary. Eventually we will have initWithModel instad of just init for moleculeviews, which will remove this need.
|
||||||
open class StringAndMoleculeStack: MoleculeStackView {
|
open class StringAndMoleculeStack: MoleculeStackView {
|
||||||
override open func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
override open func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let model = model as? StackModelProtocol,
|
guard let model = model as? StackModelProtocol,
|
||||||
let molcules = model.molecules as? [MoleculeStackItemModel] else { return }
|
let molcules = model.molecules as? [MoleculeStackItemModel] else { return }
|
||||||
for stackItemModel in molcules {
|
for stackItemModel in molcules {
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public protocol TemplateProtocol: AnyObject {
|
public protocol TemplateProtocol: AnyObject {
|
||||||
associatedtype TemplateModel: TemplateModelProtocol
|
associatedtype TemplateModel: TemplateModelProtocol
|
||||||
var templateModel: TemplateModel? { get set }
|
var templateModel: TemplateModel? { get set }
|
||||||
@ -19,6 +18,7 @@ public extension TemplateProtocol where Self: ViewController {
|
|||||||
guard let pageJSON = json else { return }
|
guard let pageJSON = json else { return }
|
||||||
let data = try JSONSerialization.data(withJSONObject: pageJSON)
|
let data = try JSONSerialization.data(withJSONObject: pageJSON)
|
||||||
let decoder = JSONDecoder()
|
let decoder = JSONDecoder()
|
||||||
|
try decoder.add(delegateObject: delegateObjectIVar)
|
||||||
let templateModel = try decoder.decode(TemplateModel.self, from: data)
|
let templateModel = try decoder.decode(TemplateModel.self, from: data)
|
||||||
self.templateModel = templateModel
|
self.templateModel = templateModel
|
||||||
self.pageModel = templateModel as? MVMControllerModelProtocol
|
self.pageModel = templateModel as? MVMControllerModelProtocol
|
||||||
|
|||||||
@ -9,6 +9,9 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var closeButton: Button?
|
public var closeButton: Button?
|
||||||
|
|
||||||
@ -17,5 +20,8 @@ open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
|||||||
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in
|
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { _ in
|
||||||
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
|
MVMCoreNavigationHandler.shared()?.removeCurrentViewController()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
accessibilityElements = [closeButton as Any, tableView as Any]
|
||||||
|
UIAccessibility.post(notification: .layoutChanged, argument: closeButton)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,12 +21,10 @@ public protocol MoleculeListCellProtocol: UITableViewCell {
|
|||||||
|
|
||||||
// Default implementation does nothing
|
// Default implementation does nothing
|
||||||
extension MoleculeListCellProtocol {
|
extension MoleculeListCellProtocol {
|
||||||
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) { }
|
||||||
}
|
|
||||||
|
|
||||||
func willDisplay() {
|
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { }
|
||||||
}
|
|
||||||
|
func willDisplay() { }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -209,8 +209,11 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
func getMoleculeInfo(with listItem: (ListItemModelProtocol & MoleculeModelProtocol)?) -> (identifier: String, class: AnyClass, molecule: ListItemModelProtocol & MoleculeModelProtocol)? {
|
func getMoleculeInfo(with listItem: (ListItemModelProtocol & MoleculeModelProtocol)?) -> (identifier: String, class: AnyClass, molecule: ListItemModelProtocol & MoleculeModelProtocol)? {
|
||||||
|
|
||||||
guard let listItem = listItem,
|
guard let listItem = listItem,
|
||||||
let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(listItem) else { return nil }
|
let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(listItem)
|
||||||
|
else { return nil }
|
||||||
|
|
||||||
let moleculeName = moleculeClass.nameForReuse(with: listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.moleculeName
|
let moleculeName = moleculeClass.nameForReuse(with: listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.moleculeName
|
||||||
|
|
||||||
return (moleculeName, moleculeClass, listItem)
|
return (moleculeName, moleculeClass, listItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -205,6 +205,8 @@ import UIKit
|
|||||||
let caret = CaretView(lineWidth: 1)
|
let caret = CaretView(lineWidth: 1)
|
||||||
caret.translatesAutoresizingMaskIntoConstraints = true
|
caret.translatesAutoresizingMaskIntoConstraints = true
|
||||||
caret.isAccessibilityElement = true
|
caret.isAccessibilityElement = true
|
||||||
|
caret.accessibilityTraits = .button
|
||||||
|
caret.accessibilityLabel = "Caret,"
|
||||||
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
caret.accessibilityHint = MVMCoreUIUtility.hardcodedString(withKey: "AccTabHint")
|
||||||
caret.size = .small(.vertical)
|
caret.size = .small(.vertical)
|
||||||
if let size = caret.size?.dimensions() {
|
if let size = caret.size?.dimensions() {
|
||||||
|
|||||||
@ -40,6 +40,7 @@ open class ThreeLayerTableViewController: ProgrammaticTableViewController {
|
|||||||
createViewForTableHeader()
|
createViewForTableHeader()
|
||||||
createViewForTableFooter()
|
createViewForTableFooter()
|
||||||
tableView?.reloadData()
|
tableView?.reloadData()
|
||||||
|
accessibilityElements = [tableView as Any]
|
||||||
}
|
}
|
||||||
|
|
||||||
override open func viewDidLoad() {
|
override open func viewDidLoad() {
|
||||||
|
|||||||
@ -17,7 +17,10 @@ import UIKit
|
|||||||
public var manager: (UIViewController & MVMCoreViewManagerProtocol)?
|
public var manager: (UIViewController & MVMCoreViewManagerProtocol)?
|
||||||
|
|
||||||
/// A temporary iVar backer for delegateObject() until we change the protocol
|
/// A temporary iVar backer for delegateObject() until we change the protocol
|
||||||
public var delegateObjectIVar: MVMCoreUIDelegateObject?
|
public let delegateObjectIVar: MVMCoreUIDelegateObject = {
|
||||||
|
return MVMCoreUIDelegateObject.create(withDelegateForAll: self)
|
||||||
|
}()
|
||||||
|
|
||||||
public func delegateObject() -> DelegateObject? {
|
public func delegateObject() -> DelegateObject? {
|
||||||
return delegateObjectIVar
|
return delegateObjectIVar
|
||||||
}
|
}
|
||||||
@ -264,9 +267,6 @@ import UIKit
|
|||||||
// Presents from the bottom.
|
// Presents from the bottom.
|
||||||
modalPresentationStyle = MVMCoreGetterUtility.isOnIPad() ? .formSheet : .overCurrentContext
|
modalPresentationStyle = MVMCoreGetterUtility.isOnIPad() ? .formSheet : .overCurrentContext
|
||||||
|
|
||||||
// Create the default delegate object.
|
|
||||||
delegateObjectIVar = MVMCoreUIDelegateObject.create(withDelegateForAll: self)
|
|
||||||
|
|
||||||
// Do some initial loading.
|
// Do some initial loading.
|
||||||
if !initialLoadFinished {
|
if !initialLoadFinished {
|
||||||
initialLoadFinished = true
|
initialLoadFinished = true
|
||||||
|
|||||||
@ -9,7 +9,12 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class ContainerHelper: NSObject {
|
open class ContainerHelper: NSObject {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Constraints
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
var leftConstraint: NSLayoutConstraint?
|
var leftConstraint: NSLayoutConstraint?
|
||||||
var topConstraint: NSLayoutConstraint?
|
var topConstraint: NSLayoutConstraint?
|
||||||
var bottomConstraint: NSLayoutConstraint?
|
var bottomConstraint: NSLayoutConstraint?
|
||||||
@ -28,17 +33,26 @@ open class ContainerHelper: NSObject {
|
|||||||
var bottomLowConstraint: NSLayoutConstraint?
|
var bottomLowConstraint: NSLayoutConstraint?
|
||||||
var rightLowConstraint: NSLayoutConstraint?
|
var rightLowConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
open func constrainView(_ view: UIView) {
|
open func constrainView(_ view: UIView) {
|
||||||
guard let margins = view.superview?.layoutMarginsGuide else { return }
|
guard let margins = view.superview?.layoutMarginsGuide else { return }
|
||||||
|
|
||||||
|
leftConstraint?.isActive = false
|
||||||
leftConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
leftConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
||||||
leftConstraint?.isActive = true
|
leftConstraint?.isActive = true
|
||||||
|
|
||||||
|
topConstraint?.isActive = false
|
||||||
topConstraint = view.topAnchor.constraint(equalTo: margins.topAnchor)
|
topConstraint = view.topAnchor.constraint(equalTo: margins.topAnchor)
|
||||||
topConstraint?.isActive = true
|
topConstraint?.isActive = true
|
||||||
|
|
||||||
|
rightConstraint?.isActive = false
|
||||||
rightConstraint = margins.rightAnchor.constraint(equalTo: view.rightAnchor)
|
rightConstraint = margins.rightAnchor.constraint(equalTo: view.rightAnchor)
|
||||||
rightConstraint?.isActive = true
|
rightConstraint?.isActive = true
|
||||||
|
|
||||||
|
bottomConstraint?.isActive = false
|
||||||
bottomConstraint = margins.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
bottomConstraint = margins.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||||
bottomConstraint?.isActive = true
|
bottomConstraint?.isActive = true
|
||||||
|
|
||||||
@ -50,23 +64,25 @@ open class ContainerHelper: NSObject {
|
|||||||
alignCenterTopConstraint = view.topAnchor.constraint(greaterThanOrEqualTo: margins.topAnchor)
|
alignCenterTopConstraint = view.topAnchor.constraint(greaterThanOrEqualTo: margins.topAnchor)
|
||||||
alignCenterBottomConstraint = margins.bottomAnchor.constraint(greaterThanOrEqualTo: view.bottomAnchor)
|
alignCenterBottomConstraint = margins.bottomAnchor.constraint(greaterThanOrEqualTo: view.bottomAnchor)
|
||||||
|
|
||||||
|
leftLowConstraint?.isActive = false
|
||||||
leftLowConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
leftLowConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
||||||
leftLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
leftLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
leftLowConstraint?.isActive = true
|
leftLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
topLowConstraint?.isActive = false
|
||||||
topLowConstraint = view.topAnchor.constraint(equalTo: margins.topAnchor)
|
topLowConstraint = view.topAnchor.constraint(equalTo: margins.topAnchor)
|
||||||
topLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
topLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
topLowConstraint?.isActive = true
|
topLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
rightLowConstraint?.isActive = false
|
||||||
rightLowConstraint = margins.rightAnchor.constraint(equalTo: view.rightAnchor)
|
rightLowConstraint = margins.rightAnchor.constraint(equalTo: view.rightAnchor)
|
||||||
rightLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
rightLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
rightLowConstraint?.isActive = true
|
rightLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
bottomLowConstraint?.isActive = false
|
||||||
bottomLowConstraint = margins.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
bottomLowConstraint = margins.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||||
bottomLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
bottomLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
bottomLowConstraint?.isActive = true
|
bottomLowConstraint?.isActive = true
|
||||||
|
|
||||||
setAccessibility(view)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open func setAccessibility(_ view: UIView) {
|
open func setAccessibility(_ view: UIView) {
|
||||||
|
|||||||
@ -53,6 +53,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// MARK: Radio Button
|
// MARK: Radio Button
|
||||||
|
"radio_button" = "Radio Button,";
|
||||||
"radio_action_hint" = "Double tap to select";
|
"radio_action_hint" = "Double tap to select";
|
||||||
"radio_selected_state" = "Selected";
|
"radio_selected_state" = "Selected";
|
||||||
"radio_not_selected_state" = "Not Selected";
|
"radio_not_selected_state" = "Not Selected";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user