Ver código fonte

prepare for search

nayooti 5 anos atrás
pai
commit
701bdabfc6
1 arquivos alterados com 18 adições e 0 exclusões
  1. 18 0
      deltachat-ios/DC/Wrapper.swift

+ 18 - 0
deltachat-ios/DC/Wrapper.swift

@@ -237,6 +237,14 @@ class DcContext {
     func setLocation(latitude: Double, longitude: Double, accuracy: Double) {
         dc_set_location(contextPointer, latitude, longitude, accuracy)
     }
+
+    func searchMessages(chatId: Int = 0, searchText: String) -> [Int] {
+        guard let arrayPointer = dc_search_msgs(contextPointer, UInt32(chatId), searchText) else {
+            return []
+        }
+        let messageIds = Utils.copyAndFreeArray(inputArray: arrayPointer)
+        return messageIds
+    }
 }
 
 class DcConfig {
@@ -888,6 +896,16 @@ class DcMsg: MessageType {
         return swiftString
     }
 
+    func summary(chat: DcChat) -> DcLot {
+        guard let chatPointer = chat.chatPointer else {
+            fatalError()
+        }
+        guard let dcLotPointer = dc_msg_get_summary(messagePointer, chatPointer) else {
+            fatalError()
+        }
+        return DcLot(dcLotPointer)
+    }
+
     func showPadlock() -> Bool {
         return dc_msg_get_showpadlock(messagePointer) == 1
     }