فهرست منبع

early prototype of split ui view

we probably need to conditionally,
open the view in splitview or in normal navigation,
becaus eon newer iphones the secondary split view column is shown as a weird overlay
Simon Laux 1 سال پیش
والد
کامیت
91a684158e
2فایلهای تغییر یافته به همراه13 افزوده شده و 2 حذف شده
  1. 2 1
      deltachat-ios/Controller/ChatListController.swift
  2. 11 1
      deltachat-ios/Coordinator/AppCoordinator.swift

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

@@ -862,7 +862,8 @@ class ChatListController: UITableViewController {
             searchController.searchBar.resignFirstResponder()
         }
         let chatVC = ChatViewController(dcContext: dcContext, chatId: chatId, highlightedMsg: highlightedMsg)
-        navigationController?.pushViewController(chatVC, animated: animated)
+        // navigationController?.pushViewController(chatVC, animated: animated)
+        splitViewController?.showDetailViewController(chatVC, sender: self)
     }
 
     public func showArchive(animated: Bool) {

+ 11 - 1
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -36,6 +36,13 @@ class AppCoordinator {
         return tabBarController
     }()
 
+    lazy var splitViewController: UISplitViewController = {
+        let splitView = UISplitViewController()
+        tabBarController.delegate = appStateRestorer
+        splitView.viewControllers = [tabBarController]
+        return splitView
+    }()
+
     private func createQrNavigationController() -> UINavigationController {
         let root = QrPageController(dcAccounts: dcAccounts)
         let nav = UINavigationController(rootViewController: root)
@@ -126,6 +133,9 @@ class AppCoordinator {
 
     func showChat(chatId: Int, msgId: Int? = nil, openHighlightedMsg: Bool = false, animated: Bool = true, clearViewControllerStack: Bool = false) {
         showTab(index: chatsTab)
+        let dcContext = dcAccounts.getSelected()
+        let chatVC1 = ChatViewController(dcContext: dcContext, chatId: chatId, highlightedMsg: msgId)
+        splitViewController.showDetailViewController(chatVC1, sender: self)
         if let rootController = self.tabBarController.selectedViewController as? UINavigationController,
            let chatListViewController = rootController.viewControllers.first as? ChatListController {
             if let msgId = msgId, openHighlightedMsg {
@@ -243,7 +253,7 @@ class AppCoordinator {
     }
 
     func presentTabBarController() {
-        window.rootViewController = tabBarController
+        window.rootViewController = splitViewController
         showTab(index: chatsTab)
         window.makeKeyAndVisible()
     }