few more improvements to work closer with molecular
This commit is contained in:
parent
da7ebdd5a2
commit
932a79dea8
@ -9,6 +9,8 @@
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class ActionCollapseNotificationModel: ActionModelProtocol {
|
||||
public var title: String?
|
||||
|
||||
public static var identifier: String = "collapseNotification"
|
||||
public var actionType: String
|
||||
public var extraParameters: JSONValueDictionary?
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
import Foundation
|
||||
|
||||
public class ActionOpenPanelModel: ActionModelProtocol {
|
||||
public var title: String?
|
||||
|
||||
|
||||
public enum Panel: String, Codable {
|
||||
case left
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class ActionTopAlertModel: ActionModelProtocol {
|
||||
public var title: String?
|
||||
|
||||
public static var identifier: String = "topAlert"
|
||||
public var actionType: String = ActionTopAlertModel.identifier
|
||||
public var pageType: String
|
||||
|
||||
@ -22,12 +22,11 @@
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case dateFormat
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
@ -42,7 +41,6 @@
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(dateFormat, forKey: .dateFormat)
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,12 +23,11 @@
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case digits
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
@ -43,7 +42,6 @@
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(digits, forKey: .digits)
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,6 @@ import UIKit
|
||||
|
||||
title = model.title
|
||||
feedback = model.feedback
|
||||
errorMessage = model.errorMessage
|
||||
isEnabled = model.enabled
|
||||
|
||||
if let isLocked = model.locked {
|
||||
|
||||
@ -20,9 +20,9 @@ import Foundation
|
||||
}
|
||||
|
||||
public var backgroundColor: Color?
|
||||
public var title: String = ""
|
||||
public var title: String?
|
||||
public var feedback: String?
|
||||
public var errorMessage: String = ""
|
||||
public var errorMessage: String?
|
||||
public var enabled: Bool = true
|
||||
public var locked: Bool?
|
||||
public var selected: Bool?
|
||||
@ -77,16 +77,16 @@ import Foundation
|
||||
baseValue = text
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
|
||||
if let title = try typeContainer.decodeIfPresent(String.self, forKey: .title) {
|
||||
self.title = title
|
||||
}
|
||||
|
||||
title = try typeContainer.decodeIfPresent(String.self, forKey: .title)
|
||||
feedback = try typeContainer.decodeIfPresent(String.self, forKey: .feedback)
|
||||
errorMessage = try typeContainer.decodeIfPresent(String.self, forKey: .errorMessage) ?? ""
|
||||
errorMessage = try typeContainer.decodeIfPresent(String.self, forKey: .errorMessage)
|
||||
enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) ?? true
|
||||
locked = try typeContainer.decodeIfPresent(Bool.self, forKey: .locked)
|
||||
selected = try typeContainer.decodeIfPresent(Bool.self, forKey: .selected)
|
||||
@ -106,7 +106,7 @@ import Foundation
|
||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||
try container.encodeIfPresent(locked, forKey: .locked)
|
||||
try container.encodeIfPresent(selected, forKey: .selected)
|
||||
try container.encode(errorMessage, forKey: .errorMessage)
|
||||
try container.encodeIfPresent(errorMessage, forKey: .errorMessage)
|
||||
try container.encode(enabled, forKey: .enabled)
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case options
|
||||
case selectedIndex
|
||||
}
|
||||
@ -48,7 +47,6 @@
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encode(options, forKey: .options)
|
||||
try container.encode(options, forKey: .selectedIndex)
|
||||
}
|
||||
|
||||
@ -49,9 +49,6 @@ import UIKit
|
||||
// MARK: - Stored Properties
|
||||
//--------------------------------------------------
|
||||
|
||||
/// Set enabled and disabled colors to be utilized when setting this texfield's isEnabled property.
|
||||
public var textColor: (enabled: UIColor?, disabled: UIColor?) = (.mvmBlack, .mvmCoolGray3)
|
||||
|
||||
private var observingForChange: Bool = false
|
||||
|
||||
/// Validate on each entry in the textField. Default: true
|
||||
@ -77,7 +74,7 @@ import UIKit
|
||||
guard let self = self else { return }
|
||||
|
||||
self.textField.isEnabled = enabled
|
||||
self.textField.textColor = enabled ? self.textColor.enabled : self.textColor.disabled
|
||||
self.textField.textColor = enabled ? self.textEntryFieldModel?.enabledTextColor.uiColor : self.textEntryFieldModel?.disabledTextColor.uiColor
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,6 +292,7 @@ import UIKit
|
||||
|
||||
} else {
|
||||
errorImage.removeFromSuperview()
|
||||
textFieldTrailingConstraint?.isActive = false
|
||||
textFieldTrailingConstraint = entryFieldContainer.trailingAnchor.constraint(equalTo: textField.trailingAnchor, constant: Padding.Two)
|
||||
textFieldTrailingConstraint?.isActive = true
|
||||
}
|
||||
@ -320,9 +318,7 @@ import UIKit
|
||||
}
|
||||
|
||||
self.delegateObject = delegateObject
|
||||
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
||||
textColor.enabled = model.enabledTextColor?.uiColor
|
||||
textColor.disabled = model.disabledTextColor?.uiColor
|
||||
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
||||
text = model.text
|
||||
placeholder = model.placeholder
|
||||
|
||||
|
||||
@ -28,8 +28,8 @@
|
||||
}
|
||||
|
||||
public var placeholder: String?
|
||||
public var enabledTextColor: Color?
|
||||
public var disabledTextColor: Color?
|
||||
public var enabledTextColor: Color = Color(uiColor: .mvmBlack)
|
||||
public var disabledTextColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||
public var type: EntryType?
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -45,16 +45,22 @@
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializers
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
try super.init(from: decoder)
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
placeholder = try typeContainer.decodeIfPresent(String.self, forKey: .placeholder)
|
||||
enabledTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledTextColor)
|
||||
disabledTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledTextColor)
|
||||
type = try typeContainer.decodeIfPresent(EntryType.self, forKey: .type)
|
||||
|
||||
if let enabledTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledTextColor) {
|
||||
self.enabledTextColor = enabledTextColor
|
||||
}
|
||||
|
||||
if let disabledTextColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledTextColor) {
|
||||
self.disabledTextColor = disabledTextColor
|
||||
}
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
@ -62,8 +68,8 @@
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(moleculeName, forKey: .moleculeName)
|
||||
try container.encodeIfPresent(placeholder, forKey: .placeholder)
|
||||
try container.encodeIfPresent(enabledTextColor, forKey: .enabledTextColor)
|
||||
try container.encodeIfPresent(disabledTextColor, forKey: .disabledTextColor)
|
||||
try container.encode(enabledTextColor, forKey: .enabledTextColor)
|
||||
try container.encode(disabledTextColor, forKey: .disabledTextColor)
|
||||
try container.encodeIfPresent(type, forKey: .type)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user