B. Petersen 4 жил өмнө
parent
commit
ef4f532952

+ 1 - 1
DcCore/DcCore/DC/Wrapper.swift

@@ -39,7 +39,7 @@ public class DcContext {
             // skip first part
             ids = DcUtils.copyAndFreeArrayWithLen(inputArray: cMessageIds, len: count)
         } else {
-            ids = DcUtils.copyAndFreeArrayWithLen(inputArray: cMessageIds)
+            ids = DcUtils.copyAndFreeArray(inputArray: cMessageIds)
         }
         return ids
     }

+ 0 - 13
DcCore/DcCore/Helper/DcUtils.swift

@@ -54,19 +54,6 @@ public struct DcUtils {
         return acc
     }
 
-
-    static func copyAndFreeArrayWithLen(inputArray: OpaquePointer?) -> [Int] {
-        var acc: [Int] = []
-        let arrayLen = dc_array_get_cnt(inputArray)
-        for i in 0 ..< arrayLen {
-            let e = dc_array_get_id(inputArray, i)
-            acc.append(Int(e))
-        }
-        dc_array_unref(inputArray)
-
-        return acc
-    }
-
     static func copyAndFreeArrayWithLen(inputArray: OpaquePointer?, len: Int = 0) -> [Int] {
         var acc: [Int] = []
         let arrayLen = dc_array_get_cnt(inputArray)

+ 1 - 22
deltachat-ios/Chat/ChatViewControllerNew.swift

@@ -440,17 +440,7 @@ class ChatViewControllerNew: UITableViewController {
         tableView.setContentOffset(newOffset, animated: false)
     }
 
-    @objc
-    private func loadMoreMessages() {
-        DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 1) {
-            DispatchQueue.main.async { [weak self] in
-                guard let self = self else { return }
-                self.messageIds = self.getMessageIds()
-                self.reloadDataAndKeepOffset()
-            }
-        }
-    }
-
+    // TODO: is the delay of one second needed?
     @objc
     private func refreshMessages() {
         DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 1) {
@@ -522,22 +512,11 @@ class ChatViewControllerNew: UITableViewController {
     private var textDraft: String? {
         return dcContext.getDraft(chatId: chatId)
     }
-
-    private func getMessageIds(_ count: Int, from: Int? = nil) -> [DcMsg] {
-        let ids = dcContext.getMessageIds(chatId: chatId, count: count, from: from)
-        let markIds: [UInt32] = ids.map { UInt32($0) }
-        dcContext.markSeenMessages(messageIds: markIds, count: ids.count)
-
-        return ids.map {
-            DcMsg(id: $0)
-        }
-    }
     
     private func getMessageIds() -> [Int] {
         return dcContext.getMessageIds(chatId: chatId)
     }
 
-
     @objc private func setTextDraft() {
         if let text = self.messageInputBar.inputTextView.text {
             dcContext.setDraft(chatId: chatId, draftText: text)