Fix for the reset() issue with default properties being reset for buttonGroup
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
558a3d7c55
commit
33dc411743
@ -31,29 +31,36 @@ import VDS
|
|||||||
isAccessibilityElement = false
|
isAccessibilityElement = false
|
||||||
addSubview(buttonGroup)
|
addSubview(buttonGroup)
|
||||||
buttonGroup.pinToSuperView()
|
buttonGroup.pinToSuperView()
|
||||||
|
heightConstraint = height(constant: VDS.Button.Size.large.height, priority: .required)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
buttonGroup.alignment = .center
|
buttonGroup.alignment = .center
|
||||||
buttonGroup.rowQuantityPhone = 2
|
buttonGroup.rowQuantityPhone = 2
|
||||||
buttonGroup.rowQuantityTablet = 2
|
buttonGroup.rowQuantityTablet = 2
|
||||||
heightConstraint = height(constant: VDS.Button.Size.large.height, priority: .required)
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
buttonGroup.reset()
|
||||||
|
super.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
buttonGroup.reset()
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let model = model as? TwoButtonViewModel,
|
guard let model = model as? TwoButtonViewModel,
|
||||||
let buttonModel = model.primaryButton ?? model.secondaryButton
|
let buttonModel = model.primaryButton ?? model.secondaryButton
|
||||||
else { return 0 }
|
else { return 0 }
|
||||||
|
|
||||||
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
var buttons = [PillButton]()
|
var buttons = [PillButton]()
|
||||||
if let secondaryModel = viewModel.secondaryButton {
|
if let secondaryModel = viewModel.secondaryButton {
|
||||||
@ -87,7 +94,5 @@ import VDS
|
|||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func updateView(_ size: CGFloat) {
|
public func updateView(_ size: CGFloat) {}
|
||||||
setNeedsUpdate()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,21 +32,20 @@ import VDS
|
|||||||
isAccessibilityElement = false
|
isAccessibilityElement = false
|
||||||
addSubview(buttonGroup)
|
addSubview(buttonGroup)
|
||||||
buttonGroup.pinToSuperView()
|
buttonGroup.pinToSuperView()
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setDefaults() {
|
||||||
|
super.setDefaults()
|
||||||
buttonGroup.alignment = .center
|
buttonGroup.alignment = .center
|
||||||
buttonGroup.rowQuantityPhone = 2
|
buttonGroup.rowQuantityPhone = 2
|
||||||
buttonGroup.rowQuantityTablet = 2
|
buttonGroup.rowQuantityTablet = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
|
||||||
//--------------------------------------------------
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
|
||||||
buttonGroup.reset()
|
buttonGroup.reset()
|
||||||
|
super.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
open func updateView(_ size: CGFloat) { }
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Stack Manipulation
|
// MARK: - Stack Manipulation
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -90,6 +89,7 @@ import VDS
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MoleculeViewProtocol
|
// MARK: - MoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open func updateView(_ size: CGFloat) { }
|
||||||
|
|
||||||
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let model = model as? TwoButtonViewModel,
|
guard let model = model as? TwoButtonViewModel,
|
||||||
@ -99,6 +99,9 @@ import VDS
|
|||||||
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
public func viewModelDidUpdate() {
|
public func viewModelDidUpdate() {
|
||||||
buttons.removeAll()
|
buttons.removeAll()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user