瀏覽代碼

add convenience function getContactIds()

Jonas Reinsch 7 年之前
父節點
當前提交
d1812fed89
共有 2 個文件被更改,包括 10 次插入11 次删除
  1. 4 11
      deltachat-ios/NewChatViewController.swift
  2. 6 0
      deltachat-ios/Utils.swift

+ 4 - 11
deltachat-ios/NewChatViewController.swift

@@ -1,22 +1,15 @@
 //
 //  NewChatViewController.swift
-//  MessageKit
+//  deltachat-ios
 //
-//  Created by Jonas Reinsch on 20.11.17.
+//  Created by Jonas Reinsch on 21.11.17.
+//  Copyright © 2017 Jonas Reinsch. All rights reserved.
 //
 
 import UIKit
 
 class NewChatViewController: UITableViewController {
-    
-    init() {
-        super.init(style: .plain)
-    }
-    
-    required init?(coder aDecoder: NSCoder) {
-        fatalError("init(coder:) has not been implemented")
-    }
-    
+
     override func viewDidLoad() {
         super.viewDidLoad()
 

+ 6 - 0
deltachat-ios/Utils.swift

@@ -10,6 +10,12 @@ import Foundation
 import UIKit
 
 struct Utils {
+    static func getContactIds() -> [Int] {
+        let c_contacts = mrmailbox_get_known_contacts(mailboxPointer, nil)
+        return Utils.copyAndFreeArray(inputArray: c_contacts)
+    }
+
+    
     static func copyAndFreeArray(inputArray:UnsafeMutablePointer<carray>?) -> [Int] {
         var acc:[Int] = []
         let len = carray_count(inputArray)