diff --git a/Sources/BackupFeature/Controllers/BackupController.swift b/Sources/BackupFeature/Controllers/BackupController.swift index a9942d8c03466fe8b620d156c9eb1cc02f2ef70a..822ebbc77c3fa46acd0d842579382101aac5b3f9 100644 --- a/Sources/BackupFeature/Controllers/BackupController.swift +++ b/Sources/BackupFeature/Controllers/BackupController.swift @@ -11,6 +11,13 @@ public final class BackupController: UIViewController { private let viewModel = BackupViewModel.live() private var cancellables = Set<AnyCancellable>() + public override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" + navigationController?.navigationBar + .customize(backgroundColor: Asset.neutralWhite.color) + } + public override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = Asset.neutralWhite.color @@ -21,19 +28,12 @@ public final class BackupController: UIViewController { } private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - let title = UILabel() title.text = Localized.Backup.header title.textColor = Asset.neutralActive.color title.font = Fonts.Mulish.semiBold.font(size: 18.0) - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back, title]) - ) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: title) + navigationItem.leftItemsSupplementBackButton = true } private func setupBindings() { @@ -70,8 +70,4 @@ public final class BackupController: UIViewController { } } } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/ChatFeature/Controllers/GroupChatController.swift b/Sources/ChatFeature/Controllers/GroupChatController.swift index b168e70c438b6660f637758270bc28761dfa5c0c..2411786865669256bff58b618488bf5fbab36aa4 100644 --- a/Sources/ChatFeature/Controllers/GroupChatController.swift +++ b/Sources/ChatFeature/Controllers/GroupChatController.swift @@ -122,14 +122,10 @@ public final class GroupChatController: UIViewController { } private func setupNavigationBar() { - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - let more = UIButton() more.setImage(Asset.chatMore.image, for: .normal) more.addTarget(self, action: #selector(didTapDots), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) navigationItem.titleView = header navigationItem.rightBarButtonItem = UIBarButtonItem(customView: more) } @@ -229,10 +225,6 @@ public final class GroupChatController: UIViewController { .store(in: &cancellables) } - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } - @objc private func didTapDots() { coordinator.toMembersList(members, from: self) } diff --git a/Sources/ChatFeature/Controllers/SingleChatController.swift b/Sources/ChatFeature/Controllers/SingleChatController.swift index f34be438f7df3afd84d5ba7c6db04612bc891cc6..d1d7785af5663f567a8803fce22aa107cbfe0934 100644 --- a/Sources/ChatFeature/Controllers/SingleChatController.swift +++ b/Sources/ChatFeature/Controllers/SingleChatController.swift @@ -35,7 +35,6 @@ public final class SingleChatController: UIViewController { lazy private var avatarView = AvatarView() lazy private var moreButton = UIButton() - lazy private var backButton = UIButton.back() lazy private var screenView = ChatView() lazy private var sheet = SheetController() @@ -168,8 +167,6 @@ public final class SingleChatController: UIViewController { nameLabel.textColor = Asset.neutralActive.color nameLabel.font = Fonts.Mulish.semiBold.font(size: 18.0) - backButton.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - moreButton.setImage(Asset.chatMore.image, for: .normal) moreButton.addTarget(self, action: #selector(didTapDots), for: .touchUpInside) @@ -188,12 +185,8 @@ public final class SingleChatController: UIViewController { $0.right.lessThanOrEqualToSuperview() } - let stackView = UIStackView() - stackView.addArrangedSubview(backButton) - stackView.addArrangedSubview(infoView) - navigationItem.rightBarButtonItem = UIBarButtonItem(customView: moreButton) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: stackView) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: infoView) } private func setupInputController() { @@ -462,10 +455,6 @@ public final class SingleChatController: UIViewController { @objc private func didTapInfo() { coordinator.toContact(viewModel.contact, from: self) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } extension SingleChatController: UICollectionViewDataSource { diff --git a/Sources/ChatListFeature/Controller/ChatListController.swift b/Sources/ChatListFeature/Controller/ChatListController.swift index bddccd284ce09ecb2b9e479044aa8fb41eb5e757..57e744a3b29d7ab15371624fe2ce0932e7f9d772 100644 --- a/Sources/ChatListFeature/Controller/ChatListController.swift +++ b/Sources/ChatListFeature/Controller/ChatListController.swift @@ -36,6 +36,13 @@ public final class ChatListController: UIViewController { } } + public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + navigationItem.backButtonTitle = "" + } + + required init?(coder: NSCoder) { nil } + public override func loadView() { view = screenView } @@ -55,7 +62,6 @@ public final class ChatListController: UIViewController { } private func setupNavigationBar() { - navigationItem.backButtonTitle = "" navigationItem.leftBarButtonItem = UIBarButtonItem(customView: topLeftView) navigationItem.rightBarButtonItem = UIBarButtonItem(customView: topRightView) diff --git a/Sources/ContactFeature/Controllers/ContactController.swift b/Sources/ContactFeature/Controllers/ContactController.swift index 02859bab60bf861a5615795a016352a4f4509900..c583654e08d1ec4ae54180a8f8dc6079c6aee9c6 100644 --- a/Sources/ContactFeature/Controllers/ContactController.swift +++ b/Sources/ContactFeature/Controllers/ContactController.swift @@ -30,6 +30,7 @@ public final class ContactController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.lightContent) navigationController?.navigationBar .customize(backgroundColor: Asset.neutralBody.color) @@ -43,7 +44,6 @@ public final class ContactController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupScrollView() setupBindings() @@ -62,14 +62,6 @@ public final class ContactController: UIViewController { screenView.set(status: viewModel.contact.authStatus) } - private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - - let back = UIButton.back(color: Asset.neutralWhite.color) - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -333,10 +325,6 @@ public final class ContactController: UIViewController { coordinator.toDrawer(drawer, from: self) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } extension ContactController: UIImagePickerControllerDelegate { diff --git a/Sources/ContactListFeature/Controllers/CreateGroupController.swift b/Sources/ContactListFeature/Controllers/CreateGroupController.swift index a9559f5c3c38ccdf7a90543a9963748155e6fa6b..e55860fc0a48220413dc33373c915e754351ebe5 100644 --- a/Sources/ContactListFeature/Controllers/CreateGroupController.swift +++ b/Sources/ContactListFeature/Controllers/CreateGroupController.swift @@ -40,22 +40,25 @@ public final class CreateGroupController: UIViewController { view = screenView } + public override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" + navigationController?.navigationBar + .customize(backgroundColor: Asset.neutralWhite.color) + } + public override func viewDidLoad() { super.viewDidLoad() setupNavigationBar() setupTableAndCollection() setupBindings() + + count = 0 } private func setupNavigationBar() { - navigationItem.backButtonTitle = " " - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back, titleLabel]) - ) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: titleLabel) + navigationItem.leftItemsSupplementBackButton = true createButton.setTitle(Localized.CreateGroup.create, for: .normal) createButton.setTitleColor(Asset.brandPrimary.color, for: .normal) @@ -166,10 +169,6 @@ public final class CreateGroupController: UIViewController { ) }.store(in: &cancellables) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } extension CreateGroupController: UITableViewDelegate { diff --git a/Sources/Countries/CountryListController.swift b/Sources/Countries/CountryListController.swift index ab7ca357c0d9f074d73c38c1616cbba81d9ed9c1..a11c0e5724696bc172f58cfdc7b4333288639b7f 100644 --- a/Sources/Countries/CountryListController.swift +++ b/Sources/Countries/CountryListController.swift @@ -24,6 +24,7 @@ public final class CountryListController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize( @@ -46,19 +47,13 @@ public final class CountryListController: UIViewController { } private func setupNavigationBar() { - navigationItem.backButtonTitle = " " - let title = UILabel() title.text = Localized.Countries.title title.textColor = Asset.neutralActive.color title.font = Fonts.Mulish.semiBold.font(size: 18.0) - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back, title]) - ) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: title) + navigationItem.leftItemsSupplementBackButton = true } private func setupBindings() { @@ -86,10 +81,6 @@ public final class CountryListController: UIViewController { screenView.tableView.delegate = self screenView.tableView.dataSource = dataSource } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if let country = dataSource.itemIdentifier(for: indexPath) { diff --git a/Sources/OnboardingFeature/Controllers/OnboardingEmailConfirmationController.swift b/Sources/OnboardingFeature/Controllers/OnboardingEmailConfirmationController.swift index 90c210569b58b904473f5c2e2020740e2945a09d..578a27dc5bdedfcd58ab9dbecfd1338c07bad324 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingEmailConfirmationController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingEmailConfirmationController.swift @@ -34,15 +34,13 @@ public final class OnboardingEmailConfirmationController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize(translucent: true) } public override func viewDidLoad() { super.viewDidLoad() - navigationItem.backButtonTitle = " " - - setupNavigationBar() setupScrollView() setupBindings() @@ -58,12 +56,6 @@ public final class OnboardingEmailConfirmationController: UIViewController { } } - private func setupNavigationBar() { - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -157,8 +149,4 @@ public final class OnboardingEmailConfirmationController: UIViewController { coordinator.toDrawer(drawer, from: self) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/OnboardingFeature/Controllers/OnboardingPhoneConfirmationController.swift b/Sources/OnboardingFeature/Controllers/OnboardingPhoneConfirmationController.swift index 0017798bc5fc2a4703a56cf6b4fc2a45fbcffa55..6207a5a7c9b19b1a5184557eb45cd07bd8aeb21b 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingPhoneConfirmationController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingPhoneConfirmationController.swift @@ -34,15 +34,13 @@ public final class OnboardingPhoneConfirmationController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize(translucent: true) } public override func viewDidLoad() { super.viewDidLoad() - navigationItem.backButtonTitle = " " - - setupNavigationBar() setupScrollView() setupBindings() @@ -58,12 +56,6 @@ public final class OnboardingPhoneConfirmationController: UIViewController { } } - private func setupNavigationBar() { - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -157,8 +149,4 @@ public final class OnboardingPhoneConfirmationController: UIViewController { coordinator.toDrawer(drawer, from: self) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift b/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift index 761128f1f148f9a1ba02b46da99de5a7f30bc6f3..d42e1f81f055d800cb2fe86afb5ac0870c6ca39a 100644 --- a/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift +++ b/Sources/OnboardingFeature/Controllers/OnboardingUsernameController.swift @@ -22,8 +22,8 @@ public final class OnboardingUsernameController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - statusBarController.style.send(.darkContent) navigationItem.backButtonTitle = "" + statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize(translucent: true) } @@ -37,7 +37,6 @@ public final class OnboardingUsernameController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupScrollView() setupBindings() diff --git a/Sources/Permissions/RequestPermissionController.swift b/Sources/Permissions/RequestPermissionController.swift index 8c787bed838c4e621c9fb17a0e713214dbf18946..d892ab60e8722633e8d7c2930eb7ec97b4049d8c 100644 --- a/Sources/Permissions/RequestPermissionController.swift +++ b/Sources/Permissions/RequestPermissionController.swift @@ -25,13 +25,13 @@ public final class RequestPermissionController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize(backgroundColor: Asset.neutralWhite.color) } public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupBindings() } @@ -60,14 +60,6 @@ public final class RequestPermissionController: UIViewController { } } - private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupBindings() { screenView.notNowButton .publisher(for: .touchUpInside) @@ -105,7 +97,4 @@ public final class RequestPermissionController: UIViewController { }.store(in: &cancellables) } - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/ProfileFeature/Controllers/ProfileCodeController.swift b/Sources/ProfileFeature/Controllers/ProfileCodeController.swift index c005b0bf9c10daa6db1f8521799da86bbfad26a4..d612b9e9e79c4dbb362b5a0c7782eb1463dc4fe6 100644 --- a/Sources/ProfileFeature/Controllers/ProfileCodeController.swift +++ b/Sources/ProfileFeature/Controllers/ProfileCodeController.swift @@ -22,6 +22,7 @@ public final class ProfileCodeController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" navigationController?.navigationBar .customize(backgroundColor: Asset.neutralWhite.color) } @@ -39,20 +40,11 @@ public final class ProfileCodeController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupScrollView() setupBindings() setupDetail() } - private func setupNavigationBar() { - navigationItem.backButtonTitle = " " - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -128,8 +120,4 @@ public final class ProfileCodeController: UIViewController { screenView.set(content, isEmail: confirmation.isEmail) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/ProfileFeature/Controllers/ProfileEmailController.swift b/Sources/ProfileFeature/Controllers/ProfileEmailController.swift index 97ced65c65a10b7d4ac8033a5b2c0d80cf959997..3fb88d2b649ed6f9f20b8189467a021563188c13 100644 --- a/Sources/ProfileFeature/Controllers/ProfileEmailController.swift +++ b/Sources/ProfileFeature/Controllers/ProfileEmailController.swift @@ -19,6 +19,7 @@ public final class ProfileEmailController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar .customize(backgroundColor: Asset.neutralWhite.color) @@ -26,19 +27,10 @@ public final class ProfileEmailController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupScrollView() setupBindings() } - private func setupNavigationBar() { - navigationItem.backButtonTitle = " " - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -89,8 +81,4 @@ public final class ProfileEmailController: UIViewController { .sink { [unowned self] in viewModel.didTapNext() } .store(in: &cancellables) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift b/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift index eb77fd14d36bce3960f30a73aa4ac7c117e453e7..01737802adc9611476892ca38675b5dd8ff6d743 100644 --- a/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift +++ b/Sources/ProfileFeature/Controllers/ProfilePhoneController.swift @@ -21,26 +21,18 @@ public final class ProfilePhoneController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar - .customize(backgroundColor: Asset.neutralWhite.color) + .customize(backgroundColor: Asset.neutralWhite.color) } public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupScrollView() setupBindings() } - private func setupNavigationBar() { - navigationItem.backButtonTitle = " " - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -107,8 +99,4 @@ public final class ProfilePhoneController: UIViewController { .sink { [unowned self] in viewModel.didTapNext() } .store(in: &cancellables) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/RestoreFeature/Controllers/RestoreController.swift b/Sources/RestoreFeature/Controllers/RestoreController.swift index b88932c148df5249e2c88184b3506e335596020f..f2081aaef8eca0773f552bf685976dbfe67d75c9 100644 --- a/Sources/RestoreFeature/Controllers/RestoreController.swift +++ b/Sources/RestoreFeature/Controllers/RestoreController.swift @@ -26,6 +26,12 @@ public final class RestoreController: UIViewController { presentWarning() } + public override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" + navigationController?.navigationBar.customize() + } + public override func viewDidLoad() { super.viewDidLoad() setupNavigationBar() @@ -33,19 +39,13 @@ public final class RestoreController: UIViewController { } private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - let title = UILabel() title.text = Localized.AccountRestore.header title.textColor = Asset.neutralActive.color title.font = Fonts.Mulish.semiBold.font(size: 18.0) - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back, title]) - ) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: title) + navigationItem.leftItemsSupplementBackButton = true } private func setupBindings() { diff --git a/Sources/RestoreFeature/Controllers/RestoreListController.swift b/Sources/RestoreFeature/Controllers/RestoreListController.swift index b396d1069df7008772290e5c9e2f275adb5ccf4b..33470e44212a67e1ee6833cfd70664aca840321f 100644 --- a/Sources/RestoreFeature/Controllers/RestoreListController.swift +++ b/Sources/RestoreFeature/Controllers/RestoreListController.swift @@ -30,27 +30,13 @@ public final class RestoreListController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" navigationController?.navigationBar.customize(translucent: true) } public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() - setupBindings() - } - - private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back]) - ) - } - private func setupBindings() { viewModel.hudPublisher .receive(on: DispatchQueue.main) .sink { [hud] in hud.update(with: $0) } diff --git a/Sources/SFTPFeature/SFTPController.swift b/Sources/SFTPFeature/SFTPController.swift index f80908b9cdf6106bacef3c2fa9f6c4eac46e8145..21bf8ca1f224ad3b5439d619fbd27025a2a96295 100644 --- a/Sources/SFTPFeature/SFTPController.swift +++ b/Sources/SFTPFeature/SFTPController.swift @@ -21,10 +21,15 @@ public final class SFTPController: UIViewController { required init?(coder: NSCoder) { nil } + public override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" + navigationController?.navigationBar.customize(translucent: true) + } + public override func viewDidLoad() { super.viewDidLoad() setupScrollView() - setupNavigationBar() setupBindings() } @@ -38,17 +43,6 @@ public final class SFTPController: UIViewController { scrollViewController.contentView = screenView } - private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back]) - ) - } - private func setupBindings() { viewModel.hudPublisher .receive(on: DispatchQueue.main) @@ -89,8 +83,4 @@ public final class SFTPController: UIViewController { .sink { [unowned self] in viewModel.didTapLogin() } .store(in: &cancellables) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/SearchFeature/Controllers/SearchContainerController.swift b/Sources/SearchFeature/Controllers/SearchContainerController.swift index 9cba53034d3a3a09a5fc5bcd80e4c48b7566eb06..3a1bf1e45af9077b7bc70315f5584be93b116242 100644 --- a/Sources/SearchFeature/Controllers/SearchContainerController.swift +++ b/Sources/SearchFeature/Controllers/SearchContainerController.swift @@ -33,6 +33,7 @@ public final class SearchContainerController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize( backgroundColor: Asset.neutralWhite.color @@ -61,19 +62,13 @@ public final class SearchContainerController: UIViewController { } private func setupNavigationBar() { - navigationItem.backButtonTitle = " " + let title = UILabel() + title.text = Localized.Ud.title + title.textColor = Asset.neutralActive.color + title.font = Fonts.Mulish.semiBold.font(size: 18.0) - let titleLabel = UILabel() - titleLabel.text = Localized.Ud.title - titleLabel.textColor = Asset.neutralActive.color - titleLabel.font = Fonts.Mulish.semiBold.font(size: 18.0) - - let backButton = UIButton.back() - backButton.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [backButton, titleLabel]) - ) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: title) + navigationItem.leftItemsSupplementBackButton = true } private func setupBindings() { @@ -98,10 +93,6 @@ public final class SearchContainerController: UIViewController { .store(in: &cancellables) } - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } - private func embedControllers() { addChild(leftController) addChild(rightController) diff --git a/Sources/SettingsFeature/Controllers/AccountDeleteController.swift b/Sources/SettingsFeature/Controllers/AccountDeleteController.swift index 1dc36e2ef958cc0c7fba6177e621915d96cfc4cc..ee5be65a72df17338ab3daca3ddcf58531057338 100644 --- a/Sources/SettingsFeature/Controllers/AccountDeleteController.swift +++ b/Sources/SettingsFeature/Controllers/AccountDeleteController.swift @@ -28,7 +28,6 @@ public final class AccountDeleteController: UIViewController { public override func viewDidLoad() { super.viewDidLoad() - setupNavigationBar() setupScrollView() setupBindings() @@ -42,12 +41,6 @@ public final class AccountDeleteController: UIViewController { } } - private func setupNavigationBar() { - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - navigationItem.leftBarButtonItem = UIBarButtonItem(customView: back) - } - private func setupScrollView() { addChild(scrollViewController) view.addSubview(scrollViewController.view) @@ -84,10 +77,6 @@ public final class AccountDeleteController: UIViewController { .store(in: &cancellables) } - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } - private func presentInfo(title: String, subtitle: String) { let actionButton = CapsuleButton() actionButton.set( diff --git a/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift b/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift index aeb6791eefb9685595edd21c816026de9f2ebb0a..a7d92763d3116ec42ea3fd5c65f8282e69f45471 100644 --- a/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift +++ b/Sources/SettingsFeature/Controllers/SettingsAdvancedController.swift @@ -17,6 +17,7 @@ public final class SettingsAdvancedController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" navigationController?.navigationBar .customize(backgroundColor: Asset.neutralWhite.color) } @@ -30,19 +31,13 @@ public final class SettingsAdvancedController: UIViewController { } private func setupNavigationBar() { - navigationItem.backButtonTitle = "" - let title = UILabel() title.text = Localized.Settings.Advanced.title title.textColor = Asset.neutralActive.color title.font = Fonts.Mulish.semiBold.font(size: 18.0) - let back = UIButton.back() - back.addTarget(self, action: #selector(didTapBack), for: .touchUpInside) - - navigationItem.leftBarButtonItem = UIBarButtonItem( - customView: UIStackView(arrangedSubviews: [back, title]) - ) + navigationItem.leftBarButtonItem = UIBarButtonItem(customView: title) + navigationItem.leftItemsSupplementBackButton = true } private func setupBindings() { @@ -79,8 +74,4 @@ public final class SettingsAdvancedController: UIViewController { screenView.showUsernamesSwitcher.switcherView.setOn(state.isShowingUsernames, animated: true) }.store(in: &cancellables) } - - @objc private func didTapBack() { - navigationController?.popViewController(animated: true) - } } diff --git a/Sources/TermsFeature/TermsConditionsController.swift b/Sources/TermsFeature/TermsConditionsController.swift index 0a5b3b5bb86885b214e3799a00e3c6d4f6d170f2..27ad6cb78e28b5eca4ee7de044afa317229e941f 100644 --- a/Sources/TermsFeature/TermsConditionsController.swift +++ b/Sources/TermsFeature/TermsConditionsController.swift @@ -29,6 +29,7 @@ public final class TermsConditionsController: UIViewController { public override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + navigationItem.backButtonTitle = "" statusBarController.style.send(.darkContent) navigationController?.navigationBar.customize(translucent: true) }