Browse Source

go back to chatlist after scan, this is the same behavior as on android and is smooth most of the times; a rescan is only one tap away

B. Petersen 5 years ago
parent
commit
536082328e

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

@@ -113,6 +113,7 @@ extension QrPageController: UIPageViewControllerDataSource, UIPageViewController
 extension QrPageController: QrCodeReaderDelegate {
 extension QrPageController: QrCodeReaderDelegate {
 
 
     func handleQrCode(_ code: String) {
     func handleQrCode(_ code: String) {
+        self.coordinator?.showChats()
         let qrParsed: DcLot = self.dcContext.checkQR(qrCode: code)
         let qrParsed: DcLot = self.dcContext.checkQR(qrCode: code)
         let state = Int32(qrParsed.state)
         let state = Int32(qrParsed.state)
         switch state {
         switch state {

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

@@ -11,7 +11,7 @@ class AppCoordinator: NSObject, Coordinator {
     private let window: UIWindow
     private let window: UIWindow
     private let dcContext: DcContext
     private let dcContext: DcContext
     private let qrTab = 0
     private let qrTab = 0
-    private let chatsTab = 1
+    public  let chatsTab = 1
     private let settingsTab = 2
     private let settingsTab = 2
 
 
     private let appStateRestorer = AppStateRestorer.shared
     private let appStateRestorer = AppStateRestorer.shared
@@ -225,6 +225,12 @@ class QrViewCoordinator: Coordinator {
         self.navigationController = navigationController
         self.navigationController = navigationController
     }
     }
 
 
+    func showChats() {
+        if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
+            appDelegate.appCoordinator.showTab(index: appDelegate.appCoordinator.chatsTab)
+        }
+    }
+
     func showChat(chatId: Int) {
     func showChat(chatId: Int) {
         if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
         if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
             appDelegate.appCoordinator.showChat(chatId: chatId)
             appDelegate.appCoordinator.showChat(chatId: chatId)