Эх сурвалжийг харах

Merge pull request #39 from deltachat/update-deps

Update deps / bugfix for showing sent msgs
Jonas Reinsch 6 жил өмнө
parent
commit
9e558bae0b

+ 1 - 1
.gitmodules

@@ -3,4 +3,4 @@
 	url = git@github.com:deltachat/deltachat-core.git
 [submodule "deltachat-ios/libraries/libetpan"]
 	path = deltachat-ios/libraries/libetpan
-	url = git@github.com:dignifiedquire/libetpan.git
+	url = git@github.com:dinhviethoa/libetpan.git

+ 21 - 9
deltachat-ios/ChatViewController.swift

@@ -118,26 +118,33 @@ class ChatViewController: MessagesViewController {
     }
 
     let nc = NotificationCenter.default
-    msgChangedObserver = nc.addObserver(forName: dcNotificationChanged,
-                                        object: nil, queue: OperationQueue.main) {
-      notification in
+    msgChangedObserver = nc.addObserver(
+      forName: dcNotificationChanged,
+      object: nil,
+      queue: OperationQueue.main
+    ) { notification in
       if let ui = notification.userInfo {
         if self.disableWriting {
           // always refresh, as we can't check currently
           self.refreshMessages()
         } else if let id = ui["message_id"] as? Int {
-          self.updateMessage(id)
+          if id > 0 {
+            self.updateMessage(id)
+          }
         }
       }
     }
 
-    incomingMsgObserver = nc.addObserver(forName: dcNotificationIncoming,
-                                         object: nil, queue: OperationQueue.main) {
-      notification in
+    incomingMsgObserver = nc.addObserver(
+      forName: dcNotificationIncoming,
+      object: nil, queue: OperationQueue.main
+    ) { notification in
       if let ui = notification.userInfo {
         if self.chatId == ui["chat_id"] as! Int {
           let id = ui["message_id"] as! Int
-          self.insertMessage(MRMessage(id: id))
+          if id > 0 {
+            self.insertMessage(MRMessage(id: id))
+          }
         }
       }
     }
@@ -445,7 +452,7 @@ extension ChatViewController: MessagesDataSource {
         string: MessageKitDateFormatter.shared.string(from: message.sentDate),
         attributes: [
           NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 10),
-          NSAttributedString.Key.foregroundColor: UIColor.darkGray
+          NSAttributedString.Key.foregroundColor: UIColor.darkGray,
         ]
       )
     }
@@ -563,6 +570,11 @@ extension ChatViewController: MessagesDataSource {
           self?.messagesCollectionView.scrollToBottom(animated: true)
         }
       })
+    } else {
+      let msg = MRMessage(id: messageId)
+      if msg.chatId == chatId {
+        insertMessage(msg)
+      }
     }
   }
 

+ 2 - 2
deltachat-ios/TopViews/SettingsController.swift

@@ -213,8 +213,8 @@ internal final class SettingsViewController: QuickTableViewController {
       ),
 
       Section(title: "Danger", rows: [
-        deleteRow
-      ])
+        deleteRow,
+      ]),
     ]
   }
 

+ 1 - 1
deltachat-ios/Wrapper.swift

@@ -313,7 +313,7 @@ class MRMessage: MessageType {
   }
 
   var timestamp: Int64 {
-    return Int64(messagePointer.pointee.timestamp)
+    return Int64(dc_msg_get_timestamp(messagePointer))
   }
 
   var isInfo: Bool {

+ 9 - 7
deltachat-ios/events.swift

@@ -104,13 +104,15 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon
     let nc = NotificationCenter.default
 
     DispatchQueue.main.async {
-      nc.post(name: dcNotificationChanged,
-              object: nil,
-              userInfo: [
-                "message_id": Int(data2),
-                "chat_id": Int(data1),
-                "date": Date(),
-      ])
+      nc.post(
+        name: dcNotificationChanged,
+        object: nil,
+        userInfo: [
+          "message_id": Int(data2),
+          "chat_id": Int(data1),
+          "date": Date(),
+        ]
+      )
     }
   case DC_EVENT_INCOMING_MSG:
     let nc = NotificationCenter.default

+ 1 - 1
deltachat-ios/libraries/deltachat-core

@@ -1 +1 @@
-Subproject commit 26cc5d82a7b759af9e16cdd10eb2335ad3270db7
+Subproject commit 6dc4063c7734377f1a3ebc151e86d96a5aa027e0

+ 1 - 1
deltachat-ios/libraries/libetpan

@@ -1 +1 @@
-Subproject commit 6e2a5f9d965fc5b8236c958440ad7ece96c29f90
+Subproject commit a8ed52a7df4fc3e2c5a52237c59a2efaa5857cac