pull
This commit is contained in:
commit
045cfeb7f9
@ -8,6 +8,7 @@
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
01004F3022721C3800991ECC /* RadioButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01004F2F22721C3800991ECC /* RadioButton.swift */; };
|
||||
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */; };
|
||||
0105618D224BBE7700E1557D /* FormValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618A224BBE7700E1557D /* FormValidator.swift */; };
|
||||
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */; };
|
||||
0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */; };
|
||||
@ -310,6 +311,7 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
01004F2F22721C3800991ECC /* RadioButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButton.swift; sourceTree = "<group>"; };
|
||||
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyToggleModel.swift; sourceTree = "<group>"; };
|
||||
0105618A224BBE7700E1557D /* FormValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidator.swift; sourceTree = "<group>"; };
|
||||
0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+TextFields.swift"; sourceTree = "<group>"; };
|
||||
0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+FormParams.swift"; sourceTree = "<group>"; };
|
||||
@ -809,6 +811,7 @@
|
||||
01C851D223CF9E740021F976 /* LabelToggleModel.swift */,
|
||||
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */,
|
||||
);
|
||||
path = SwitchMolecules;
|
||||
sourceTree = "<group>";
|
||||
@ -1540,6 +1543,7 @@
|
||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
|
||||
94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */,
|
||||
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */,
|
||||
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
||||
0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */,
|
||||
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
||||
|
||||
@ -66,7 +66,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt
|
||||
} else {
|
||||
guard let label = label else { return }
|
||||
|
||||
let accessibleAction = UIAccessibilityCustomAction(name: actionText ?? "", target: label, selector: #selector(label.accessibilityCustomAction(_:)))
|
||||
let accessibleAction = UIAccessibilityCustomAction(name: actionText ?? "label", target: label, selector: #selector(label.accessibilityCustomAction(_:)))
|
||||
label.clauses = [Label.ActionableClause(range: actionRange, actionBlock: newActionBlock, accessibilityID: accessibleAction.hash)]
|
||||
label.accessibilityCustomActions = [accessibleAction]
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ import UIKit
|
||||
public static var identifier: String = "line"
|
||||
public var type: Style = .standard
|
||||
public var frequency: Frequency? = .allExceptTop
|
||||
public var color: Color?
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public init(type: Style) {
|
||||
@ -53,6 +54,7 @@ import UIKit
|
||||
case moleculeName
|
||||
case type
|
||||
case backgroundColor
|
||||
case color
|
||||
case frequency
|
||||
}
|
||||
|
||||
@ -64,7 +66,7 @@ import UIKit
|
||||
if let frequency = try typeContainer.decodeIfPresent(Frequency.self, forKey: .frequency) {
|
||||
self.frequency = frequency
|
||||
}
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
color = try typeContainer.decodeIfPresent(Color.self, forKey: .color)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
@ -72,6 +74,6 @@ import UIKit
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(type, forKey: .type)
|
||||
try container.encodeIfPresent(frequency, forKey: .frequency)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeIfPresent(color, forKey: .color)
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
||||
public var backgroundColor: Color?
|
||||
public var state: Bool = true
|
||||
public var action: ActionModelProtocol?
|
||||
public var alternateAction: ActionModelProtocol?
|
||||
public var required: Bool?
|
||||
public var fieldKey: String?
|
||||
|
||||
@ -24,6 +25,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
||||
case backgroundColor
|
||||
case required
|
||||
case fieldKey
|
||||
case alternateAction
|
||||
}
|
||||
|
||||
public init(_ state: Bool) {
|
||||
@ -36,6 +38,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
||||
self.state = state
|
||||
}
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction, typeCodingKey: ActionCodingKey.actionType)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required)
|
||||
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
||||
@ -45,6 +48,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeModelIfPresent(action, forKey: .action)
|
||||
try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encodeIfPresent(state, forKey: .state)
|
||||
try container.encodeIfPresent(required, forKey: .required)
|
||||
|
||||
@ -24,8 +24,12 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
@interface MVMCoreUISplitViewController : UIViewController
|
||||
|
||||
// Reference to the panels.
|
||||
@property (nullable, weak, nonatomic, readonly) UIViewController <MVMCoreUIPanelProtocol> *leftPanel;
|
||||
@property (nullable, weak, nonatomic, readonly) UIViewController <MVMCoreUIPanelProtocol> *rightPanel;
|
||||
@property (nullable, weak, nonatomic) UIViewController <MVMCoreUIPanelProtocol> *leftPanel;
|
||||
@property (nullable, weak, nonatomic) UIViewController <MVMCoreUIPanelProtocol> *rightPanel;
|
||||
|
||||
// For keeping
|
||||
@property (nullable, strong, nonatomic) UIViewController <MVMCoreUIPanelProtocol> *globalLeftPanel;
|
||||
@property (nullable, strong, nonatomic) UIViewController <MVMCoreUIPanelProtocol> *globalRightPanel;
|
||||
|
||||
// Can be of protocol MVMCoreUIPanelButtonProtocol
|
||||
@property (nullable, strong, nonatomic) UIBarButtonItem *leftPanelButton;
|
||||
@ -79,6 +83,9 @@ typedef NS_ENUM(NSInteger, MFNumberOfDrawers) {
|
||||
// contains speicaly logic to set the icon color
|
||||
- (void)setNavigationIconColor:(nullable UIColor *)color;
|
||||
|
||||
///create right and left panel. if left and right panel is already created, will replace them
|
||||
- (void)createPanels;
|
||||
|
||||
/// Updates the panels that are used.
|
||||
- (void)setupPanels;
|
||||
|
||||
|
||||
@ -44,12 +44,6 @@ typedef NS_OPTIONS(NSInteger, MFExtendedDrawer) {
|
||||
@property (weak, nonatomic) UIView *leftPanelSeparator;
|
||||
@property (weak, nonatomic) UIView *rightPanelSeparator;
|
||||
|
||||
// For keeping
|
||||
@property (strong, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *globalLeftPanel;
|
||||
@property (strong, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *globalRightPanel;
|
||||
|
||||
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *leftPanel;
|
||||
@property (weak, nonatomic, readwrite) UIViewController <MVMCoreUIPanelProtocol> *rightPanel;
|
||||
@property (weak, nonatomic, readwrite) NavigationController *navigationController;
|
||||
|
||||
// A view that covers the detail view when the master is out.
|
||||
@ -355,6 +349,9 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
|
||||
- (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict {
|
||||
if (!self.leftPanel) {
|
||||
return;
|
||||
}
|
||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||
if (self.mainViewLeading.constant < .1) {
|
||||
BOOL shouldExtendLeftPanel = [self shouldExtendLeftPanel];
|
||||
@ -548,6 +545,9 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
|
||||
- (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict {
|
||||
if (!self.rightPanel) {
|
||||
return;
|
||||
}
|
||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||
if (self.mainViewTrailing.constant < .1) {
|
||||
BOOL shouldExtendRightPanel = [self shouldExtendRightPanel];
|
||||
@ -766,6 +766,13 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createPanels {
|
||||
// Create panels
|
||||
self.globalLeftPanel = [self createLeftPanelViewController];
|
||||
self.globalRightPanel = [self createRightPanelViewController];
|
||||
[self setupPanels];
|
||||
}
|
||||
|
||||
- (void)setupPanels {
|
||||
[self forceHideBothDrawers];
|
||||
[self setupLeftPanel];
|
||||
@ -862,10 +869,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
||||
[NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
|
||||
[NSLayoutConstraint constraintWithItem:coverView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:mainView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
|
||||
|
||||
// Create panels
|
||||
self.globalLeftPanel = [self createLeftPanelViewController];
|
||||
self.globalRightPanel = [self createRightPanelViewController];
|
||||
[self setupPanels];
|
||||
[self createPanels];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
|
||||
@ -10,18 +10,18 @@ import UIKit
|
||||
|
||||
@objcMembers open class HeadlineBodySwitch: View {
|
||||
public let headlineBody = HeadlineBody(frame: .zero)
|
||||
public let mvmSwitch = MVMCoreUISwitch.mvmSwitchDefault()
|
||||
public let toggle = Toggle()
|
||||
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
headlineBody.updateView(size)
|
||||
mvmSwitch.updateView(size)
|
||||
toggle.updateView(size)
|
||||
}
|
||||
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
guard mvmSwitch.superview == nil else {
|
||||
guard toggle.superview == nil else {
|
||||
return
|
||||
}
|
||||
headlineBody.styleListItem()
|
||||
@ -30,8 +30,8 @@ import UIKit
|
||||
NSLayoutConstraint.constraintPinSubview(toSuperview: view)
|
||||
|
||||
view.addSubview(headlineBody)
|
||||
view.addSubview(mvmSwitch)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: mvmSwitch)
|
||||
view.addSubview(toggle)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: toggle)
|
||||
}
|
||||
|
||||
|
||||
@ -39,6 +39,10 @@ import UIKit
|
||||
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
||||
return
|
||||
}
|
||||
setWithJSON(headlineBodyToggleModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
@ -50,7 +54,7 @@ import UIKit
|
||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
toggle.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
open class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
@ -59,14 +63,14 @@ import UIKit
|
||||
|
||||
open override func setAsMolecule() {
|
||||
headlineBody.setAsMolecule()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||
(toggle as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||
headlineBody.styleListItem()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.reset()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||
(toggle as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||
headlineBody.styleListItem()
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
//
|
||||
// HeadlineBodyToggleModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Suresh, Kamlesh on 1/21/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
open class HeadlineBodyToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyToggle"
|
||||
open var backgroundColor: Color?
|
||||
open var headlineBody: HeadlineBodyModel
|
||||
open var toggle: ToggleModel
|
||||
|
||||
public init(_ headlineBody: HeadlineBodyModel, _ toggle: ToggleModel) {
|
||||
self.headlineBody = headlineBody
|
||||
self.toggle = toggle
|
||||
}
|
||||
}
|
||||
@ -15,9 +15,8 @@ import Foundation
|
||||
public var style: String?
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public init(headline: LabelModel, body: LabelModel) {
|
||||
public init(headline: LabelModel) {
|
||||
self.headline = headline
|
||||
self.body = body
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -70,5 +70,6 @@ import Foundation
|
||||
ModelRegistry.register(DoughnutChartModel.self)
|
||||
ModelRegistry.register(NumberedListModel.self)
|
||||
ModelRegistry.register(UnOrderedListModel.self)
|
||||
ModelRegistry.register(HeadlineBodyToggleModel.self)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user