Bläddra i källkod

Get rid of Tab bar buttons and tab bar

Alla Reinsch 7 år sedan
förälder
incheckning
0583f47ca5
2 ändrade filer med 6 tillägg och 30 borttagningar
  1. 4 28
      deltachat-ios/AppCoordinator.swift
  2. 2 2
      deltachat-ios/ChatListController.swift

+ 4 - 28
deltachat-ios/AppCoordinator.swift

@@ -13,10 +13,10 @@ protocol Coordinator {
 }
 
 class AppCoordinator: Coordinator {
-    let tabBarController = UITabBarController()
+    let baseController = UIViewController()
 
     func setupViewControllers(window: UIWindow) {
-        window.rootViewController = tabBarController
+        window.rootViewController = baseController
         window.makeKeyAndVisible()
         window.backgroundColor = UIColor.white
         
@@ -32,39 +32,15 @@ class AppCoordinator: Coordinator {
             let credentialsController = CredentialsController()
             let credentialsNav = UINavigationController(rootViewController: credentialsController)
 
-            tabBarController.present(credentialsNav, animated: false, completion: nil)
+            baseController.present(credentialsNav, animated: false, completion: nil)
         }
     }
     
     func setupInnerViewControllers() {
 
-        let contactViewController = ContactViewController(coordinator: self)
-        let contactNavigationController = UINavigationController(rootViewController: contactViewController)
-        
         let chatViewController = ChatListController()
         let chatNavigationController = UINavigationController(rootViewController: chatViewController)
         
-        let settingsViewController = UIViewController()
-        let settingsNavigationController = UINavigationController(rootViewController: settingsViewController)
-        settingsViewController.title = "Settings"
-        settingsViewController.navigationController?.navigationBar.prefersLargeTitles = true
-        
-        let chatIcon = #imageLiteral(resourceName: "ic_chat_36pt").withRenderingMode(.alwaysTemplate)
-        let contactsIcon = #imageLiteral(resourceName: "ic_people_36pt").withRenderingMode(.alwaysTemplate)
-        let settingsIcon = #imageLiteral(resourceName: "ic_settings_36pt").withRenderingMode(.alwaysTemplate)
-        
-        let contactTabbarItem = UITabBarItem(title: "Contacts", image: contactsIcon, tag: 0)
-        let chatTabbarItem = UITabBarItem(title: "Chats", image: chatIcon, tag: 1)
-        let settingsTabbarItem = UITabBarItem(title: "Settings", image: settingsIcon, tag: 2)
-        
-        contactNavigationController.tabBarItem = contactTabbarItem
-        chatNavigationController.tabBarItem = chatTabbarItem
-        settingsNavigationController.tabBarItem = settingsTabbarItem
-        
-        tabBarController.viewControllers = [
-//            contactNavigationController,
-            chatNavigationController,
-            settingsNavigationController,
-        ]
+        baseController.present(chatNavigationController, animated: false, completion: nil)
     }
 }

+ 2 - 2
deltachat-ios/ChatListController.swift

@@ -93,7 +93,7 @@ class ChatListController: UIViewController {
         actionSheet.addAction(UIAlertAction(title: "New group",
                                             style: .default,
                                             handler: {a in print("New group")}))
-        actionSheet.addAction(UIAlertAction(title: "Scan QR code",
+/*: actionSheet.addAction(UIAlertAction(title: "Scan QR code",
                                             style: .default,
                                             handler: {a in print("Scan QR code")}))
         actionSheet.addAction(UIAlertAction(title: "Show QR code",
@@ -101,7 +101,7 @@ class ChatListController: UIViewController {
                                             handler: {a in print("Show QR code")}))
         actionSheet.addAction(UIAlertAction(title: "Contact requests",
                                             style: .default,
-                                            handler: {a in print("Contact requests")}))
+                                            handler: {a in print("Contact requests")}))*/
         actionSheet.addAction(UIAlertAction(title: "Settings",
                                             style: .default,
                                             handler: {a in print("Settings")}))