Skip to content
Snippets Groups Projects

Using variadic param to navigate straight to UD after registration

4 files
+ 168
152
Compare changes
  • Side-by-side
  • Inline

Files

@@ -61,11 +61,6 @@ public final class ChatListController: UIViewController {
navigationController?.navigationBar.customize(backgroundColor: Asset.neutralWhite.color)
}
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
viewModel.viewDidAppear()
}
public override func viewDidLoad() {
super.viewDidLoad()
setupNavigationBar()
@@ -143,18 +138,6 @@ public final class ChatListController: UIViewController {
.sink { [unowned self] in coordinator.toScan(from: self) }
.store(in: &cancellables)
viewModel.askDummyTrafficPublisher
.receive(on: DispatchQueue.main)
.sink { [unowned self] in
presentPopup(
title: Localized.ChatList.Traffic.title,
subtitle: Localized.ChatList.Traffic.subtitle,
actionTitle: Localized.ChatList.Traffic.positive,
cancelTitle: Localized.ChatList.Traffic.negative,
action: { [weak self] in self?.viewModel.didEnableDummyTraffic() }
)
}.store(in: &cancellables)
tableController.deletePublisher
.receive(on: DispatchQueue.main)
.sink { [unowned self] ip in
@@ -295,68 +278,6 @@ public final class ChatListController: UIViewController {
coordinator.toPopup(popup, from: self)
}
private func presentPopup(
title: String,
subtitle: String,
actionTitle: String,
cancelTitle: String,
action: @escaping () -> Void
) {
let actionButton = CapsuleButton()
actionButton.set(style: .brandColored, title: actionTitle)
let cancelButton = CapsuleButton()
cancelButton.set(style: .seeThrough, title: cancelTitle)
let popup = BottomPopup(with: [
PopupLabel(
font: Fonts.Mulish.bold.font(size: 26.0),
text: title,
color: Asset.neutralActive.color,
alignment: .left,
spacingAfter: 19
),
PopupLabel(
font: Fonts.Mulish.regular.font(size: 16.0),
text: subtitle,
color: Asset.neutralBody.color,
alignment: .left,
lineHeightMultiple: 1.1,
spacingAfter: 39
),
PopupStackView(
axis: .horizontal,
spacing: 20,
distribution: .fillEqually,
views: [actionButton, cancelButton]
)
])
actionButton
.publisher(for: .touchUpInside)
.receive(on: DispatchQueue.main)
.sink {
popup.dismiss(animated: true) { [weak self] in
guard let self = self else { return }
self.popupCancellables.removeAll()
action()
}
}.store(in: &popupCancellables)
cancelButton
.publisher(for: .touchUpInside)
.receive(on: DispatchQueue.main)
.sink {
popup.dismiss(animated: true) { [weak self] in
guard let self = self else { return }
self.popupCancellables.removeAll()
}
}.store(in: &popupCancellables)
coordinator.toPopup(popup, from: self)
}
}
extension ChatListController: MenuDelegate {}
Loading