浏览代码

Merge pull request #1070 from deltachat/phone_number_selection

add default call iOS action if phone number was tapped
cyBerta 4 年之前
父节点
当前提交
a20dc9c09b
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      deltachat-ios/Chat/ChatViewController.swift

+ 5 - 1
deltachat-ios/Chat/ChatViewController.swift

@@ -1302,7 +1302,11 @@ extension ChatViewController: BaseMessageCellDelegate {
         if handleUIMenu() || handleSelection(indexPath: indexPath) {
             return
         }
-        logger.debug("phone number tapped \(number)")
+        let sanitizedNumber = number.filter("0123456789".contains)
+        if let phoneURL = URL(string: "tel://\(sanitizedNumber)") {
+            UIApplication.shared.open(phoneURL, options: [:], completionHandler: nil)
+        }
+        logger.debug("phone number tapped \(sanitizedNumber)")
     }
 
     @objc func commandTapped(command: String, indexPath: IndexPath) {