removed secondary notification

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-03-28 09:24:20 -05:00
parent 1b447df46f
commit 83d0ea1fbf

View File

@ -29,17 +29,11 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
items: Notification.Style.allCases) items: Notification.Style.allCases)
}() }()
var notification = Notification()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
stackView.insertArrangedSubview(notification, at: 0)
addContentTopView(view: component) addContentTopView(view: component)
notification.title = titleDefaultText
notification.subTitle = subtitleDefaultText
component.title = titleDefaultText component.title = titleDefaultText
component.subTitle = subtitleDefaultText component.subTitle = subtitleDefaultText
titleTextField.text = titleDefaultText titleTextField.text = titleDefaultText
@ -71,13 +65,11 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
titleTextField.textPublisher.sink { [weak self] newString in titleTextField.textPublisher.sink { [weak self] newString in
guard let self else { return } guard let self else { return }
self.component.title = newString self.component.title = newString
self.notification.title = newString
}.store(in: &subscribers) }.store(in: &subscribers)
subTitleTextField.textPublisher.sink { [weak self] newString in subTitleTextField.textPublisher.sink { [weak self] newString in
guard let self else { return } guard let self else { return }
self.component.subTitle = newString self.component.subTitle = newString
self.notification.subTitle = newString
}.store(in: &subscribers) }.store(in: &subscribers)
buttonGroupToggle.onChange = { [weak self] toggle in buttonGroupToggle.onChange = { [weak self] toggle in
@ -85,9 +77,6 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
if toggle.isOn { if toggle.isOn {
self.component.primaryButtonModel = nil self.component.primaryButtonModel = nil
self.component.secondaryButtonModel = nil self.component.secondaryButtonModel = nil
self.notification.primaryButtonModel = nil
self.notification.secondaryButtonModel = nil
self.label.text = "" self.label.text = ""
} else { } else {
self.setupButtons(with: self.firstButtonDefaultText, secondButtonText: self.secondButtonDefaultText) self.setupButtons(with: self.firstButtonDefaultText, secondButtonText: self.secondButtonDefaultText)
@ -115,7 +104,6 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
hideCloseButtonToggle.onChange = { [weak self] toggle in hideCloseButtonToggle.onChange = { [weak self] toggle in
guard let self else { return } guard let self else { return }
self.component.hideCloseButton = toggle.isOn self.component.hideCloseButton = toggle.isOn
self.notification.hideCloseButton = toggle.isOn
} }
} }
@ -124,14 +112,12 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
guard let self else { return } guard let self else { return }
self.component.surface = item self.component.surface = item
self.notification.surface = item
self.contentTopView.backgroundColor = item.color self.contentTopView.backgroundColor = item.color
} }
notificationTypePickerSelectorView.onPickerDidSelect = { [weak self] item in notificationTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
guard let self else { return } guard let self else { return }
self.component.style = item self.component.style = item
self.notification.style = item
} }
} }
@ -140,18 +126,12 @@ class NotificationViewController: BaseViewController<VDS.Notification> {
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"
}) })
notification.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in
self?.label.text = "\(button.text!) button click"
})
} }
if let secondButtonText { if let secondButtonText {
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"
}) })
notification.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in
self?.label.text = "\(button.text!) button click"
})
} }
} }
} }