Addressed PR comments

Moved the 'backBarButtonItem' into the BaseVC (and removed it for being duplicated in various view controllers)
Removed a redundant line of code
This commit is contained in:
Morgan Pretty 2022-03-01 10:25:54 +11:00
parent b077061714
commit 110c7bb01a
4 changed files with 6 additions and 14 deletions

View File

@ -466,11 +466,6 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
// MARK: Updating
func updateNavBarButtons() {
// Back button (to appear on pushed screen)
let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
backButton.tintColor = Colors.text
navigationItem.backBarButtonItem = backButton
navigationItem.hidesBackButton = isShowingSearchUI
if isShowingSearchUI {
@ -478,7 +473,6 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
navigationItem.rightBarButtonItems = []
}
else {
navigationItem.hidesBackButton = false
navigationItem.leftBarButtonItem = UIViewController.createOWSBackButton(withTarget: self, selector: #selector(handleBackPressed))
if let contactThread: TSContactThread = thread as? TSContactThread {

View File

@ -394,11 +394,6 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, NewConv
pathStatusView.pin(.trailing, to: .trailing, of: profilePictureViewContainer)
pathStatusView.pin(.bottom, to: .bottom, of: profilePictureViewContainer)
// Back button (to appear on pushed screen)
let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
backButton.tintColor = Colors.text
navigationItem.backBarButtonItem = backButton
// Left bar button item
let leftBarButtonItem = UIBarButtonItem(customView: profilePictureViewContainer)
leftBarButtonItem.accessibilityLabel = "Settings button"

View File

@ -139,9 +139,6 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate {
setUpNavBarStyle()
setNavBarTitle(NSLocalizedString("vc_settings_title", comment: ""))
// Navigation bar buttons
let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
backButton.tintColor = Colors.text
navigationItem.backBarButtonItem = backButton
updateNavigationBarButtons()
// Profile picture view
let profilePictureTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(showEditProfilePictureUI))

View File

@ -46,6 +46,7 @@ class BaseVC : UIViewController {
internal func setUpNavBarStyle() {
guard let navigationBar = navigationController?.navigationBar else { return }
if #available(iOS 15.0, *) {
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
@ -59,6 +60,11 @@ class BaseVC : UIViewController {
navigationBar.isTranslucent = false
navigationBar.barTintColor = Colors.navigationBarBackground
}
// Back button (to appear on pushed screen)
let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
backButton.tintColor = Colors.text
navigationItem.backBarButtonItem = backButton
}
internal func setNavBarTitle(_ title: String, customFontSize: CGFloat? = nil) {