浏览代码

open browser if user taps on video invite chat

cyberta 4 年之前
父节点
当前提交
2d715e032f
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 7 0
      DcCore/DcCore/DC/Wrapper.swift
  2. 4 0
      deltachat-ios/Chat/ChatViewController.swift

+ 7 - 0
DcCore/DcCore/DC/Wrapper.swift

@@ -1144,6 +1144,13 @@ public class DcMsg {
         return dc_msg_get_showpadlock(messagePointer) == 1
         return dc_msg_get_showpadlock(messagePointer) == 1
     }
     }
 
 
+    public func getVideoChatUrl() -> String {
+        guard let cString = dc_msg_get_videochat_url(messagePointer) else { return "" }
+        let swiftString = String(cString: cString)
+        dc_str_unref(cString)
+        return swiftString
+    }
+
 }
 }
 
 
 public class DcContact {
 public class DcContact {

+ 4 - 0
deltachat-ios/Chat/ChatViewController.swift

@@ -704,6 +704,10 @@ class ChatViewController: UITableViewController {
             message.type == DC_MSG_AUDIO ||
             message.type == DC_MSG_AUDIO ||
             message.type == DC_MSG_VOICE {
             message.type == DC_MSG_VOICE {
             showMediaGalleryFor(message: message)
             showMediaGalleryFor(message: message)
+        } else if message.type == DC_MSG_VIDEOCHAT_INVITATION {
+            if let url = NSURL(string: message.getVideoChatUrl()) {
+                UIApplication.shared.open(url as URL)
+            }
         }
         }
         _ = handleUIMenu()
         _ = handleUIMenu()
     }
     }