fixes
This commit is contained in:
parent
47ccd681ae
commit
d69dbc41d0
@ -50,6 +50,7 @@
|
|||||||
0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198F79E225679870066C936 /* FormValidationProtocol.swift */; };
|
0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198F79E225679870066C936 /* FormValidationProtocol.swift */; };
|
||||||
0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0198F7A02256A80A0066C936 /* MFRadioButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0198F7A02256A80A0066C936 /* MFRadioButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0198F7A22256A80A0066C936 /* MFRadioButton.m */; };
|
0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0198F7A22256A80A0066C936 /* MFRadioButton.m */; };
|
||||||
|
01C851D323CF9E740021F976 /* LabelToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01C851D223CF9E740021F976 /* LabelToggleModel.swift */; };
|
||||||
01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
|
01E569D3223FFFA500327251 /* ThreeLayerViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = D2A5146A2214905000345BFB /* ThreeLayerViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
01EB3684236097C0006832FA /* MoleculeProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB3683236097C0006832FA /* MoleculeProtocol.swift */; };
|
01EB3684236097C0006832FA /* MoleculeProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB3683236097C0006832FA /* MoleculeProtocol.swift */; };
|
||||||
01EB368F23609801006832FA /* LabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB368823609801006832FA /* LabelModel.swift */; };
|
01EB368F23609801006832FA /* LabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB368823609801006832FA /* LabelModel.swift */; };
|
||||||
@ -333,6 +334,7 @@
|
|||||||
0198F79E225679870066C936 /* FormValidationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidationProtocol.swift; sourceTree = "<group>"; };
|
0198F79E225679870066C936 /* FormValidationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidationProtocol.swift; sourceTree = "<group>"; };
|
||||||
0198F7A02256A80A0066C936 /* MFRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFRadioButton.h; sourceTree = "<group>"; };
|
0198F7A02256A80A0066C936 /* MFRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFRadioButton.h; sourceTree = "<group>"; };
|
||||||
0198F7A22256A80A0066C936 /* MFRadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFRadioButton.m; sourceTree = "<group>"; };
|
0198F7A22256A80A0066C936 /* MFRadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFRadioButton.m; sourceTree = "<group>"; };
|
||||||
|
01C851D223CF9E740021F976 /* LabelToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelToggleModel.swift; sourceTree = "<group>"; };
|
||||||
01EB3683236097C0006832FA /* MoleculeProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeProtocol.swift; sourceTree = "<group>"; };
|
01EB3683236097C0006832FA /* MoleculeProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeProtocol.swift; sourceTree = "<group>"; };
|
||||||
01EB368823609801006832FA /* LabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelModel.swift; sourceTree = "<group>"; };
|
01EB368823609801006832FA /* LabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelModel.swift; sourceTree = "<group>"; };
|
||||||
01EB368923609801006832FA /* ListItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListItemModel.swift; sourceTree = "<group>"; };
|
01EB368923609801006832FA /* ListItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListItemModel.swift; sourceTree = "<group>"; };
|
||||||
@ -756,6 +758,7 @@
|
|||||||
children = (
|
children = (
|
||||||
01509D942327ED1900EF99AA /* HeadlineBodyTextButtonSwitch.swift */,
|
01509D942327ED1900EF99AA /* HeadlineBodyTextButtonSwitch.swift */,
|
||||||
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
||||||
|
01C851D223CF9E740021F976 /* LabelToggleModel.swift */,
|
||||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||||
);
|
);
|
||||||
path = SwitchMolecules;
|
path = SwitchMolecules;
|
||||||
@ -1438,6 +1441,7 @@
|
|||||||
9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */,
|
9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */,
|
||||||
D29DF17C21E69E1F003B2FB9 /* MFTextButton.m in Sources */,
|
D29DF17C21E69E1F003B2FB9 /* MFTextButton.m in Sources */,
|
||||||
9445891F2385D2E900DE9FD4 /* CaretViewModel.swift in Sources */,
|
9445891F2385D2E900DE9FD4 /* CaretViewModel.swift in Sources */,
|
||||||
|
01C851D323CF9E740021F976 /* LabelToggleModel.swift in Sources */,
|
||||||
D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */,
|
D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */,
|
||||||
012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */,
|
012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */,
|
||||||
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
|
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
|
||||||
|
|||||||
@ -17,7 +17,7 @@ extension MVMCoreUISwitch: ModelMoleculeViewProtocol {
|
|||||||
FormValidator.setupValidation(molecule: castSelf, delegate: delegateObject?.formValidationProtocol)
|
FormValidator.setupValidation(molecule: castSelf, delegate: delegateObject?.formValidationProtocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
setState(model.on, animated: false)
|
setState(model.state, animated: false)
|
||||||
|
|
||||||
guard let action = model.action else { return }
|
guard let action = model.action else { return }
|
||||||
actionBlock = {
|
actionBlock = {
|
||||||
|
|||||||
@ -423,16 +423,16 @@ const CGFloat SwitchShakeIntensity = 2;
|
|||||||
return UIAccessibilityTraitButton;
|
return UIAccessibilityTraitButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString * _Nullable)formFieldGroupName {
|
|
||||||
return [self.json string:@"groupName"];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSString *)accessibilityHint {
|
- (NSString *)accessibilityHint {
|
||||||
return [MVMCoreUIUtility hardcodedStringWithKey:@"AccToggleHint"];
|
return [MVMCoreUIUtility hardcodedStringWithKey:@"AccToggleHint"];
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark FormValidationProtocol
|
#pragma mark FormValidationProtocol
|
||||||
|
|
||||||
|
- (NSString * _Nullable)formFieldGroupName {
|
||||||
|
return [self.json string:@"groupName"];
|
||||||
|
}
|
||||||
|
|
||||||
- (BOOL)isValidField {
|
- (BOOL)isValidField {
|
||||||
return self.isOn && [self.json boolForKey:@"required"];
|
return self.isOn && [self.json boolForKey:@"required"];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -332,6 +332,15 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
guard let toggleModel = model as? ToggleModel else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let toggleModelJSON = toggleModel.toJSON()
|
||||||
|
setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Accessibility
|
// MARK: - Accessibility
|
||||||
|
|||||||
@ -10,32 +10,44 @@ import UIKit
|
|||||||
|
|
||||||
public class ToggleModel: MoleculeProtocol {
|
public class ToggleModel: MoleculeProtocol {
|
||||||
public static var identifier: String = "toggle"
|
public static var identifier: String = "toggle"
|
||||||
|
public var moleculeName: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var on: Bool = true
|
public var state: Bool = true
|
||||||
public var action: ActionProtocol?
|
public var action: ActionProtocol?
|
||||||
|
public var required: Bool?
|
||||||
|
public var fieldKey: String?
|
||||||
|
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case on
|
case moleculeName
|
||||||
|
case state
|
||||||
case action
|
case action
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
|
case required
|
||||||
|
case fieldKey
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(_ on: Bool) {
|
public init(_ state: Bool) {
|
||||||
self.on = on
|
self.state = state
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
if let on = try typeContainer.decodeIfPresent(Bool.self, forKey: .on) {
|
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
|
||||||
self.on = on
|
self.state = state
|
||||||
}
|
}
|
||||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required)
|
||||||
|
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(state, forKey: .state)
|
||||||
|
try container.encodeIfPresent(required, forKey: .required)
|
||||||
|
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -297,8 +297,8 @@ extension TwoButtonView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TwoButtonView: MoleculeViewProtocol {
|
extension TwoButtonView: ModelMoleculeViewProtocol {
|
||||||
func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let model = model as? TwoButtonViewModel else { return }
|
guard let model = model as? TwoButtonViewModel else { return }
|
||||||
setupUI(primaryButtonShowing: model.primaryButton != nil, secondaryButtonShowing: model.secondaryButton != nil)
|
setupUI(primaryButtonShowing: model.primaryButton != nil, secondaryButtonShowing: model.secondaryButton != nil)
|
||||||
setDefaultCustom()
|
setDefaultCustom()
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers public class LabelSwitch: ViewConstrainingView {
|
@objcMembers public class LabelSwitch: ViewConstrainingView, ModelMoleculeViewProtocol {
|
||||||
let label = Label.commonLabelB1(true)
|
let label = Label.commonLabelB1(true)
|
||||||
let mvmSwitch = MVMCoreUISwitch.mvmSwitchDefault()
|
let mvmSwitch = Toggle()
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
@ -40,6 +40,14 @@ import UIKit
|
|||||||
label.setWithJSON(json?.optionalDictionaryForKey("label"), delegateObject: delegateObject, additionalData: additionalData)
|
label.setWithJSON(json?.optionalDictionaryForKey("label"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
guard let labelToggleModel = model as? LabelToggleModel else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
label.setWithModel(labelToggleModel.label, delegateObject, additionalData)
|
||||||
|
mvmSwitch.setWithModel(labelToggleModel.toggle, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
return MVMCoreUISwitch.estimatedHeight(forRow: json, delegateObject: delegateObject)
|
return MVMCoreUISwitch.estimatedHeight(forRow: json, delegateObject: delegateObject)
|
||||||
|
|||||||
@ -0,0 +1,16 @@
|
|||||||
|
//
|
||||||
|
// LabelToggle.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Suresh, Kamlesh on 1/15/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public class LabelToggleModel: MoleculeProtocol {
|
||||||
|
public static var identifier: String = "labelToggle"
|
||||||
|
public var backgroundColor: Color?
|
||||||
|
public var label: LabelModel
|
||||||
|
public var toggle: ToggleModel
|
||||||
|
}
|
||||||
@ -12,6 +12,7 @@ import Foundation
|
|||||||
public static func registerObjects() {
|
public static func registerObjects() {
|
||||||
ModelRegistry.register(LabelModel.self)
|
ModelRegistry.register(LabelModel.self)
|
||||||
ModelRegistry.register(HeaderModel.self)
|
ModelRegistry.register(HeaderModel.self)
|
||||||
|
ModelRegistry.register(FooterModel.self)
|
||||||
ModelRegistry.register(HeadlineBodyModel.self)
|
ModelRegistry.register(HeadlineBodyModel.self)
|
||||||
ModelRegistry.register(MoleculeStackModel.self)
|
ModelRegistry.register(MoleculeStackModel.self)
|
||||||
ModelRegistry.register(StackItemModel.self)
|
ModelRegistry.register(StackItemModel.self)
|
||||||
@ -51,5 +52,6 @@ import Foundation
|
|||||||
ModelRegistry.register(LeftRightLabelModel.self)
|
ModelRegistry.register(LeftRightLabelModel.self)
|
||||||
ModelRegistry.register(CaretViewModel.self)
|
ModelRegistry.register(CaretViewModel.self)
|
||||||
ModelRegistry.register(CaretLinkModel.self)
|
ModelRegistry.register(CaretLinkModel.self)
|
||||||
|
ModelRegistry.register(LabelToggleModel.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user