notification bug fixes
This commit is contained in:
parent
3e2fd50e17
commit
cac7180be5
@ -53,12 +53,16 @@ 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 model.topAction?.actionType == ActionNoopModel.identifier {
|
||||
topView.button.addActionBlock(event: .touchUpInside) { [weak self] (button) in
|
||||
Button.performButtonAction(with: model.topAction!, button: button, delegateObject: delegateObject, additionalData: additionalData)
|
||||
self?.expand(topViewShowing: model.alwaysShowTopLabel)
|
||||
}
|
||||
}
|
||||
|
||||
// Set initial collapse/expand state.
|
||||
topView.isHidden = !model.alwaysShowTopLabel && !model.initiallyCollapsed
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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]?) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user