فهرست منبع

small titles for subviews, big titles for main views

cyberta 5 سال پیش
والد
کامیت
3077c1ca0a

+ 4 - 0
deltachat-ios/Controller/AccountSetup/PortSettingsController.swift

@@ -63,6 +63,10 @@ class PortSettingsController: UITableViewController {
         resetButton.isEnabled = false
     }
 
+    override func viewWillAppear(_ animated: Bool) {
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
+    }
+
     override func viewWillDisappear(_ animated: Bool) {
         onDismiss?("\(currentPort)")
     }

+ 4 - 0
deltachat-ios/Controller/AccountSetup/SecuritySettingsController.swift

@@ -43,6 +43,10 @@ class SecuritySettingsController: UITableViewController {
         navigationItem.rightBarButtonItem = resetButton
     }
 
+    override func viewWillAppear(_ animated: Bool) {
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
+    }
+
     override func viewWillDisappear(_ animated: Bool) {
         let selectedOption = options[selectedIndex]
         onDismiss?(selectedOption)

+ 1 - 0
deltachat-ios/Controller/AccountSetupController.swift

@@ -248,6 +248,7 @@ class AccountSetupController: UITableViewController {
         imapPortCell.detailTextLabel?.text = DcConfig.mailPort ?? DcConfig.configuredMailPort
         smtpSecurityCell.detailTextLabel?.text = SecurityConverter.convertHexToString(type: .SMTPSecurity, hex: DcConfig.getSmtpSecurity())
         imapSecurityCell.detailTextLabel?.text  = SecurityConverter.convertHexToString(type: .IMAPSecurity, hex: DcConfig.getImapSecurity())
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
     }
 
     override func viewDidAppear(_ animated: Bool) {

+ 1 - 14
deltachat-ios/Controller/ChatListController.swift

@@ -33,21 +33,10 @@ class ChatListController: UIViewController {
 
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
-
-        if #available(iOS 11.0, *) {
-            navigationController?.navigationBar.prefersLargeTitles = true
-            navigationItem.largeTitleDisplayMode = .always
-        }
+        NavBarUtils.setBigTitle(navigationController: navigationController)
         getChatList()
     }
 
-    override func viewWillDisappear(_ animated: Bool) {
-        super.viewWillDisappear(animated)
-        if #available(iOS 11.0, *) {
-            navigationController?.navigationBar.prefersLargeTitles = false
-        }
-    }
-
     override func viewDidAppear(_ animated: Bool) {
         super.viewDidAppear(animated)
         let nc = NotificationCenter.default
@@ -90,8 +79,6 @@ class ChatListController: UIViewController {
             title = String.localized("chat_archived_chats_title")
         }
 
-        navigationController?.navigationBar.prefersLargeTitles = true
-
         newButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.compose, target: self, action: #selector(didPressNewChat))
         newButton.tintColor = DcColors.primary
         navigationItem.rightBarButtonItem = newButton

+ 1 - 13
deltachat-ios/Controller/ChatViewController.swift

@@ -76,7 +76,7 @@ class ChatViewController: MessagesViewController {
 
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
-
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
         // this will be removed in viewWillDisappear
         navigationController?.navigationBar.addGestureRecognizer(navBarTap)
 
@@ -97,12 +97,6 @@ class ChatViewController: MessagesViewController {
 
         configureMessageMenu()
 
-        if #available(iOS 11.0, *) {
-            if disableWriting {
-                navigationController?.navigationBar.prefersLargeTitles = true
-            }
-        }
-
         let nc = NotificationCenter.default
         msgChangedObserver = nc.addObserver(
             forName: dcNotificationChanged,
@@ -146,12 +140,6 @@ class ChatViewController: MessagesViewController {
         let cnt = Int(dc_get_fresh_msg_cnt(mailboxPointer, UInt32(chatId)))
         logger.info("updating count for chat \(cnt)")
         UIApplication.shared.applicationIconBadgeNumber = cnt
-
-        if #available(iOS 11.0, *) {
-            if disableWriting {
-                navigationController?.navigationBar.prefersLargeTitles = false
-            }
-        }
     }
 
     override func viewDidDisappear(_ animated: Bool) {

+ 1 - 1
deltachat-ios/Controller/DcNavigationController.swift

@@ -8,7 +8,7 @@ final class DcNavigationController: UINavigationController {
         super.viewDidLoad()
 
         if #available(iOS 11.0, *) {
-            navigationBar.prefersLargeTitles = true
+            // preferred height of navigation bar title is configured in ViewControllers
         } else {
             navigationBar.setBackgroundImage(UIImage(), for: .default)
         }

+ 4 - 0
deltachat-ios/Controller/EditGroupViewController.swift

@@ -41,6 +41,10 @@ class EditGroupViewController: UITableViewController {
         navigationItem.leftBarButtonItem = cancelButton
     }
 
+    override func viewWillAppear(_ animated: Bool) {
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
+    }
+
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
         return groupNameCell
     }

+ 1 - 0
deltachat-ios/Controller/EditSettingsController.swift

@@ -39,6 +39,7 @@ class EditSettingsController: UITableViewController {
     override func viewWillAppear(_ animated: Bool) {
         displayNameBackup = DcConfig.displayname
         statusCellBackup = DcConfig.selfstatus
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
     }
 
     override func viewWillDisappear(_ animated: Bool) {

+ 1 - 0
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -69,6 +69,7 @@ class GroupChatDetailViewController: UIViewController {
         updateGroupMembers()
         chatDetailTable.reloadData() // to display updates
         editBarButtonItem.isEnabled = currentUser != nil
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
     }
 
     private func updateGroupMembers() {

+ 5 - 1
deltachat-ios/Controller/GroupMembersViewController.swift

@@ -6,7 +6,6 @@ class NewGroupViewController: GroupMembersViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         title = String.localized("menu_new_group")
-        navigationController?.navigationBar.prefersLargeTitles = false
         let groupCreationNextButton = UIBarButtonItem(title: String.localized("next"),
                                                       style: .done,
                                                       target: self,
@@ -15,6 +14,11 @@ class NewGroupViewController: GroupMembersViewController {
         contactIds = Utils.getContactIds()
     }
 
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
+    }
+
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
     }

+ 4 - 0
deltachat-ios/Controller/GroupNameController.swift

@@ -31,6 +31,10 @@ class GroupNameController: UITableViewController {
         // setupSubviews()
     }
 
+    override func viewWillAppear(_ animated: Bool) {
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
+    }
+
     @objc func doneButtonPressed() {
         let groupChatId = dc_create_group_chat(mailboxPointer, 0, groupName)
         for contactId in contactIdsForGroup {

+ 6 - 3
deltachat-ios/Controller/MailboxViewController.swift

@@ -16,9 +16,12 @@ class MailboxViewController: ChatViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         navigationItem.title = String.localized("menu_deaddrop")
-        if #available(iOS 11.0, *) {
-            navigationController?.navigationBar.prefersLargeTitles = true
-        }
+
+    }
+
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+        NavBarUtils.setBigTitle(navigationController: navigationController)
     }
 
 }

+ 4 - 0
deltachat-ios/Controller/MessageInfoViewController.swift

@@ -19,6 +19,10 @@ class MessageInfoViewController: UITableViewController {
         title = String.localized("menu_message_details")
     }
 
+    override func viewWillAppear(_ animated: Bool) {
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
+    }
+
     // MARK: - Table view data source
 
     override func numberOfSections(in _: UITableView) -> Int {

+ 1 - 0
deltachat-ios/Controller/NewChatViewController.swift

@@ -81,6 +81,7 @@ class NewChatViewController: UITableViewController {
         // this will show the searchbar on launch -> will be set back to true on viewDidAppear
         if #available(iOS 11.0, *) {
             navigationItem.hidesSearchBarWhenScrolling = false
+            navigationController?.navigationBar.prefersLargeTitles = false
         }
     }
 

+ 1 - 7
deltachat-ios/Controller/NewContactController.swift

@@ -60,7 +60,7 @@ class NewContactController: UITableViewController {
 
     override func viewWillAppear(_: Bool) {
         navigationController?.setNavigationBarHidden(false, animated: false)
-        navigationController?.navigationBar.prefersLargeTitles = false
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
     }
 
     @objc func emailTextChanged() {
@@ -87,12 +87,6 @@ class NewContactController: UITableViewController {
         fatalError("init(coder:) has not been implemented")
     }
 
-    override func viewDidLoad() {
-        super.viewDidLoad()
-
-        navigationController?.navigationBar.prefersLargeTitles = true
-    }
-
     override func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
         return cells.count
     }

+ 1 - 0
deltachat-ios/Controller/QrCodeReaderController.swift

@@ -66,6 +66,7 @@ class QrCodeReaderController: UIViewController {
 
     override func viewWillAppear(_ animated: Bool) {
         captureSession.startRunning()
+        NavBarUtils.setSmallTitle(navigationController: navigationController)
     }
     override func viewWillDisappear(_ animated: Bool) {
         captureSession.stopRunning()

+ 2 - 4
deltachat-ios/Controller/QrViewController.swift

@@ -48,10 +48,8 @@ class QrViewController: UITableViewController, QrCodeReaderDelegate {
         }
     }
 
-    override func viewWillAppear(_: Bool) {
-        if #available(iOS 11.0, *) {
-            navigationController?.navigationBar.prefersLargeTitles = true
-        }
+    override func viewWillAppear(_ animated: Bool) {
+        NavBarUtils.setBigTitle(navigationController: navigationController)
     }
 
     override func numberOfSections(in _: UITableView) -> Int {

+ 1 - 10
deltachat-ios/Controller/SettingsController.swift

@@ -67,16 +67,7 @@ internal final class SettingsViewController: QuickTableViewController {
     override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
         setTable()
-        if #available(iOS 11.0, *) {
-            navigationController?.navigationBar.prefersLargeTitles = true
-        }
-    }
-
-    override func viewWillDisappear(_ animated: Bool) {
-        super.viewWillDisappear(animated)
-        if #available(iOS 11.0, *) {
-            navigationController?.navigationBar.prefersLargeTitles = false
-        }
+        NavBarUtils.setBigTitle(navigationController: navigationController)
     }
 
     override func viewDidDisappear(_ animated: Bool) {