Merge branch 'feature/molecular_top_alert_tracking' into 'release/8_1_0'

notification bug fixes

See merge request BPHV_MIPS/mvm_core_ui!600
This commit is contained in:
Suresh, Kamlesh Jain 2020-09-24 10:52:50 -04:00
commit 342b9bc2ed
4 changed files with 28 additions and 5 deletions

View File

@ -53,12 +53,17 @@ import Foundation
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
guard let model = model as? CollapsableNotificationModel else { return }
topView.label.set(with: model.topLabel, delegateObject, additionalData)
topView.button.set(with: model.topAction, delegateObject: delegateObject, additionalData: additionalData)
topView.updateAccessibility()
topView.set(with: model, delegateObject, additionalData)
bottomView.set(with: model, delegateObject, additionalData)
// Update top view default noop to expand.
if let topAction = model.topAction,
topAction.actionType == ActionNoopModel.identifier {
topView.button.addActionBlock(event: .touchUpInside) { [weak self] (button) in
Button.performButtonAction(with: topAction, button: button, delegateObject: delegateObject, additionalData: additionalData)
self?.expand(topViewShowing: model.alwaysShowTopLabel)
}
}
// Set initial collapse/expand state.
topView.isHidden = !model.alwaysShowTopLabel && !model.initiallyCollapsed

View File

@ -43,6 +43,13 @@ import Foundation
label.updateView(size)
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
guard let model = model as? CollapsableNotificationModel else { return }
label.set(with: model.topLabel, delegateObject, additionalData)
button.set(with: model.topAction, delegateObject: delegateObject, additionalData: additionalData)
updateAccessibility()
}
open override func reset() {
super.reset()
label.setFontStyle(.BoldBodySmall)

View File

@ -31,6 +31,16 @@ import Foundation
super.setupView()
reset()
// Buttons should have highest priority, then headline, then body
headline.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 500), for: .horizontal)
headline.setContentHuggingPriority(.required, for: .vertical)
body.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 500), for: .horizontal)
body.setContentHuggingPriority(.required, for: .vertical)
headline.setContentCompressionResistancePriority(UILayoutPriority(rawValue: body.contentCompressionResistancePriority(for: .vertical).rawValue + 40), for: .vertical)
headline.lineBreakMode = .byTruncatingTail
body.lineBreakMode = .byTruncatingTail
button.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
labelStack = Stack<StackModel>.createStack(with: [headline, body], spacing: 0)
horizontalStack = Stack<StackModel>.createStack(with: [(view: labelStack, model: StackItemModel()),(view: button, model: StackItemModel(horizontalAlignment: .fill)),(view: closeButton, model: StackItemModel(horizontalAlignment: .fill))], axis: .horizontal)
addSubview(horizontalStack)

View File

@ -25,6 +25,7 @@ import Foundation
tintColor = .white
adjustsImageWhenHighlighted = false
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "AccCloseButton")
setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {