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:
commit
342b9bc2ed
@ -53,13 +53,18 @@ import Foundation
|
|||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? CollapsableNotificationModel else { return }
|
guard let model = model as? CollapsableNotificationModel else { return }
|
||||||
|
topView.set(with: model, delegateObject, additionalData)
|
||||||
topView.label.set(with: model.topLabel, delegateObject, additionalData)
|
|
||||||
topView.button.set(with: model.topAction, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
topView.updateAccessibility()
|
|
||||||
|
|
||||||
bottomView.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.
|
// Set initial collapse/expand state.
|
||||||
topView.isHidden = !model.alwaysShowTopLabel && !model.initiallyCollapsed
|
topView.isHidden = !model.alwaysShowTopLabel && !model.initiallyCollapsed
|
||||||
topView.button.isUserInteractionEnabled = model.initiallyCollapsed
|
topView.button.isUserInteractionEnabled = model.initiallyCollapsed
|
||||||
|
|||||||
@ -43,6 +43,13 @@ import Foundation
|
|||||||
label.updateView(size)
|
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() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
label.setFontStyle(.BoldBodySmall)
|
label.setFontStyle(.BoldBodySmall)
|
||||||
|
|||||||
@ -31,6 +31,16 @@ import Foundation
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
reset()
|
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)
|
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)
|
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)
|
addSubview(horizontalStack)
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import Foundation
|
|||||||
tintColor = .white
|
tintColor = .white
|
||||||
adjustsImageWhenHighlighted = false
|
adjustsImageWhenHighlighted = false
|
||||||
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "AccCloseButton")
|
accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "AccCloseButton")
|
||||||
|
setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user