Merge branch 'bugfix/atomic-buttonGroup' into 'develop'
Fix for the reset() issue with default properties being reset for buttonGroup ### Summary There were buttongroup properties added in the setup() method, however they were getting removed in reset(). ### JIRA Ticket https://onejira.verizon.com/browse/CXTDT-602228 Co-authored-by: Matt Bruce <matt.bruce@verizon.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core_ui/-/merge_requests/1175
This commit is contained in:
commit
ffd5242cde
@ -10,7 +10,7 @@ import UIKit
|
||||
import VDS
|
||||
|
||||
@objcMembers open class TwoButtonView: VDS.View, VDSMoleculeViewProtocol {
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Properties
|
||||
//--------------------------------------------------
|
||||
@ -31,29 +31,38 @@ import VDS
|
||||
isAccessibilityElement = false
|
||||
addSubview(buttonGroup)
|
||||
buttonGroup.pinToSuperView()
|
||||
heightConstraint = height(constant: VDS.Button.Size.large.height, priority: .required)
|
||||
}
|
||||
|
||||
open override func setDefaults() {
|
||||
super.setDefaults()
|
||||
buttonGroup.alignment = .center
|
||||
buttonGroup.rowQuantityPhone = 2
|
||||
buttonGroup.rowQuantityTablet = 2
|
||||
heightConstraint = height(constant: VDS.Button.Size.large.height, priority: .required)
|
||||
}
|
||||
|
||||
|
||||
open override func reset() {
|
||||
//we want to reset() all local views/controls first before calling
|
||||
//super since super.reset() calls setDefaults().
|
||||
buttonGroup.reset()
|
||||
super.reset()
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - MoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
buttonGroup.reset()
|
||||
}
|
||||
|
||||
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
guard let model = model as? TwoButtonViewModel,
|
||||
let buttonModel = model.primaryButton ?? model.secondaryButton
|
||||
else { return 0 }
|
||||
let buttonModel = model.primaryButton ?? model.secondaryButton
|
||||
else { return 0 }
|
||||
|
||||
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - VDSMoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
public func viewModelDidUpdate() {
|
||||
var buttons = [PillButton]()
|
||||
if let secondaryModel = viewModel.secondaryButton {
|
||||
@ -65,7 +74,7 @@ import VDS
|
||||
primaryButton.set(with: primaryModel, delegateObject, additionalData)
|
||||
buttons.append(primaryButton)
|
||||
}
|
||||
|
||||
|
||||
buttonGroup.childWidth = viewModel.fillContainer ? .percentage(100) : nil
|
||||
|
||||
if buttons.count != buttonGroup.buttons.count {
|
||||
@ -74,7 +83,7 @@ import VDS
|
||||
|
||||
heightConstraint?.constant = primaryButton.size == .small || secondaryButton.size == .small ? VDS.Button.Size.small.height : VDS.Button.Size.large.height
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||
//--------------------------------------------------
|
||||
@ -87,7 +96,5 @@ import VDS
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
public func updateView(_ size: CGFloat) {
|
||||
setNeedsUpdate()
|
||||
}
|
||||
public func updateView(_ size: CGFloat) {}
|
||||
}
|
||||
|
||||
@ -32,21 +32,22 @@ import VDS
|
||||
isAccessibilityElement = false
|
||||
addSubview(buttonGroup)
|
||||
buttonGroup.pinToSuperView()
|
||||
}
|
||||
|
||||
open override func setDefaults() {
|
||||
super.setDefaults()
|
||||
buttonGroup.alignment = .center
|
||||
buttonGroup.rowQuantityPhone = 2
|
||||
buttonGroup.rowQuantityTablet = 2
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
//we want to reset() all local views/controls first before calling
|
||||
//super since super.reset() calls setDefaults().
|
||||
buttonGroup.reset()
|
||||
super.reset()
|
||||
}
|
||||
|
||||
open func updateView(_ size: CGFloat) { }
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Stack Manipulation
|
||||
//--------------------------------------------------
|
||||
@ -90,7 +91,8 @@ import VDS
|
||||
//--------------------------------------------------
|
||||
// MARK: - MoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
open func updateView(_ size: CGFloat) { }
|
||||
|
||||
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
guard let model = model as? TwoButtonViewModel,
|
||||
let buttonModel = model.primaryButton ?? model.secondaryButton
|
||||
@ -99,6 +101,9 @@ import VDS
|
||||
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - VDSMoleculeViewProtocol
|
||||
//--------------------------------------------------
|
||||
public func viewModelDidUpdate() {
|
||||
buttons.removeAll()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user