浏览代码

handle DC_QR_ADDR

B. Petersen 5 年之前
父节点
当前提交
92fa60c799
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      deltachat-ios/Controller/QrViewController.swift

+ 12 - 0
deltachat-ios/Controller/QrViewController.swift

@@ -164,6 +164,18 @@ class QrViewController: UITableViewController, QrCodeReaderDelegate {
             alert.addAction(UIAlertAction(title: String.localized("ok"), style: .default, handler: nil))
             alert.addAction(UIAlertAction(title: String.localized("ok"), style: .default, handler: nil))
             present(alert, animated: true, completion: nil)
             present(alert, animated: true, completion: nil)
 
 
+        case DC_QR_ADDR:
+            let nameAndAddress = DcContact(id: qrParsed.id).nameNAddr
+            let msg = String.localizedStringWithFormat(String.localized("ask_start_chat_with"), nameAndAddress)
+            let alert = UIAlertController(title: msg, message: nil, preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: String.localized("start_chat"), style: .default, handler: { _ in
+                let chatId = self.dcContext.createChat(contactId: qrParsed.id)
+                self.coordinator?.showChat(chatId: chatId)
+            }))
+            alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .default, handler: nil))
+            present(alert, animated: true, completion: nil)
+
+
         case DC_QR_TEXT:
         case DC_QR_TEXT:
             let msg = String.localizedStringWithFormat(String.localized("qrscan_contains_text"), qrParsed.text1 ?? "")
             let msg = String.localizedStringWithFormat(String.localized("qrscan_contains_text"), qrParsed.text1 ?? "")
             let alert = UIAlertController(title: msg, message: nil, preferredStyle: .alert)
             let alert = UIAlertController(title: msg, message: nil, preferredStyle: .alert)