瀏覽代碼

allow joining groups when tapping openpgp4fpr:-links

B. Petersen 3 年之前
父節點
當前提交
e1e9ee2047

+ 1 - 6
deltachat-ios/AppDelegate.swift

@@ -135,12 +135,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
 
         switch url.scheme?.lowercased() {
         case "openpgp4fpr":
-            // Hack to format url properly
-            let urlString = url.absoluteString
-                           .replacingOccurrences(of: "openpgp4fpr", with: "OPENPGP4FPR", options: .literal, range: nil)
-                           .replacingOccurrences(of: "%23", with: "#", options: .literal, range: nil)
-
-            self.appCoordinator.handleQRCode(urlString)
+            self.appCoordinator.handleQRCode(url.absoluteString)
             return true
         case "mailto":
             return self.appCoordinator.handleMailtoURL(url)

+ 3 - 1
deltachat-ios/Chat/Views/Cells/BaseMessageCell.swift

@@ -464,7 +464,9 @@ extension BaseMessageCell: MessageLabelDelegate {
     public func didSelectHashtag(_ hashtag: String) {}
 
     public func didSelectCustom(_ pattern: String, match: String?) {
-        logger.debug("did select CUSTOM")
+        if let appDelegate = UIApplication.shared.delegate as? AppDelegate, let match = match {
+            appDelegate.appCoordinator.handleQRCode(match)
+        }
     }
 }
 

+ 4 - 0
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -125,6 +125,10 @@ class AppCoordinator {
     }
     
     func handleQRCode(_ code: String) {
+        // Hack to format url properly
+        let code = code.replacingOccurrences(of: "openpgp4fpr", with: "OPENPGP4FPR", options: .literal, range: nil)
+                       .replacingOccurrences(of: "%23", with: "#", options: .literal, range: nil)
+
         showTab(index: qrTab)
         if let navController = self.tabBarController.selectedViewController as? UINavigationController,
            let topViewController = navController.topViewController,