Browse Source

refactor sending messages with attached videos

cyberta 5 years ago
parent
commit
c3036cef6d
1 changed files with 4 additions and 5 deletions
  1. 4 5
      deltachat-ios/Controller/ChatViewController.swift

+ 4 - 5
deltachat-ios/Controller/ChatViewController.swift

@@ -759,11 +759,10 @@ extension ChatViewController: MessagesDataSource {
     }
 
     private func sendVideo(url: NSURL) {
-        let msg = dc_msg_new(mailboxPointer, DC_MSG_VIDEO)
-        if let path = url.relativePath?.cString(using: .utf8) { //absoluteString?.cString(using: .utf8) {
-            dc_msg_set_file(msg, path, "video/mov")
-            dc_send_msg(mailboxPointer, UInt32(chatId), msg)
-            dc_msg_unref(msg)
+        DispatchQueue.global().async {
+            let msg = DcMsg(viewType: DC_MSG_VIDEO)
+            msg.setFile(filepath: url.relativePath, mimeType: "video/mov")
+            msg.sendInChat(id: self.chatId)
         }
     }