ui bug for notification

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-04-11 14:50:55 -05:00
parent 2578335940
commit 842485fb49

View File

@ -97,7 +97,7 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
secondButtonTextField.textPublisher.sink { [weak self] newString in secondButtonTextField.textPublisher.sink { [weak self] newString in
guard let self else { return } guard let self else { return }
if !(self.firstButtonTextField.text?.isEmpty ?? true){ if !(self.firstButtonTextField.text?.isEmpty ?? true){
self.setupButtons(secondButtonText: newString) self.setupButtons(with: self.firstButtonTextField.text, secondButtonText: newString)
} }
}.store(in: &subscribers) }.store(in: &subscribers)
@ -122,16 +122,20 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
} }
func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) { func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) {
if let firstButtonText { if let firstButtonText, !firstButtonText.isEmpty {
component.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in component.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in
self?.label.text = "\(button.text!) button click" self?.label.text = "\(button.text!) button click"
}) })
} else {
component.primaryButtonModel = nil
} }
if let secondButtonText { if let secondButtonText, !secondButtonText.isEmpty {
component.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in component.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in
self?.label.text = "\(button.text!) button click" self?.label.text = "\(button.text!) button click"
}) })
} else {
component.secondaryButtonModel = nil
} }
} }
} }