Browse Source

always show ChatListController on sendToChat()

B. Petersen 2 years ago
parent
commit
a94b4622d6
1 changed files with 6 additions and 1 deletions
  1. 6 1
      deltachat-ios/Controller/WebxdcViewController.swift

+ 6 - 1
deltachat-ios/Controller/WebxdcViewController.swift

@@ -366,7 +366,12 @@ extension WebxdcViewController: WKScriptMessageHandler {
             let base64 = dict["base64"] as? String
             let data = base64 != nil ? Data(base64Encoded: base64 ?? "") : nil
             RelayHelper.shared.setForwardMessage(text: dict["text"] as? String, fileData: data, fileName: dict["name"] as? String)
-            navigationController?.popViewControllers(viewsToPop: 2, animated: true) // TODO: xdc may be in profile, all media, whatnot, just popping 2 is wrong
+
+            if let appDelegate = UIApplication.shared.delegate as? AppDelegate,
+               let rootController = appDelegate.appCoordinator.tabBarController.selectedViewController as? UINavigationController {
+                appDelegate.appCoordinator.showTab(index: appDelegate.appCoordinator.chatsTab)
+                rootController.popToRootViewController(animated: false)
+            }
 
         default:
             logger.debug("another method was called")