Преглед изворни кода

Added ContactViewController

Bastian van de Wetering пре 7 година
родитељ
комит
7393d1342d

+ 2 - 0
.gitignore

@@ -35,4 +35,6 @@ xcuserdata/
 !*.xcworkspace/contents.xcworkspacedata
 /*.gcno
 
+.DS_Store
+
 # End of https://www.gitignore.io/api/xcode

+ 4 - 0
deltachat-ios.xcodeproj/project.pbxproj

@@ -67,6 +67,7 @@
 		AEACE2E11FB3271700DCDD78 /* SampleData.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E01FB3271700DCDD78 /* SampleData.swift */; };
 		AEACE2E31FB32B5C00DCDD78 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E21FB32B5C00DCDD78 /* Constants.swift */; };
 		AEACE2E51FB32E1900DCDD78 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E41FB32E1900DCDD78 /* Utils.swift */; };
+		AEACE2E91FB34D9100DCDD78 /* ContactViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEACE2E81FB34D9100DCDD78 /* ContactViewController.swift */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -210,6 +211,7 @@
 		AEACE2E01FB3271700DCDD78 /* SampleData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleData.swift; sourceTree = "<group>"; };
 		AEACE2E21FB32B5C00DCDD78 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
 		AEACE2E41FB32E1900DCDD78 /* Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Utils.swift; sourceTree = "<group>"; };
+		AEACE2E81FB34D9100DCDD78 /* ContactViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactViewController.swift; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -350,6 +352,7 @@
 				AEACE2E01FB3271700DCDD78 /* SampleData.swift */,
 				AEACE2E21FB32B5C00DCDD78 /* Constants.swift */,
 				AEACE2E41FB32E1900DCDD78 /* Utils.swift */,
+				AEACE2E81FB34D9100DCDD78 /* ContactViewController.swift */,
 			);
 			path = "deltachat-ios";
 			sourceTree = "<group>";
@@ -608,6 +611,7 @@
 			buildActionMask = 2147483647;
 			files = (
 				7A79236E1FB0A2C800BC2DE5 /* misc.c in Sources */,
+				AEACE2E91FB34D9100DCDD78 /* ContactViewController.swift in Sources */,
 				7A9FB5561FB08557001FEA36 /* mrtools.c in Sources */,
 				7A7923731FB0A2C800BC2DE5 /* signature.c in Sources */,
 				7A9FB5541FB08557001FEA36 /* mrsqlite3.c in Sources */,

+ 8 - 3
deltachat-ios/AppCoordinator.swift

@@ -8,10 +8,15 @@
 
 import UIKit
 
-class AppCoordinator {
+protocol Coordinator {
+    func setupViewControllers(window: UIWindow)
+}
+
+
+class AppCoordinator: Coordinator {
     
-    func setupMainViewControllers(window: UIWindow) {
-        let contactViewController = UIViewController()
+    func setupViewControllers(window: UIWindow) {
+        let contactViewController = ContactViewController(coordinator: self)
         contactViewController.view.backgroundColor = UIColor.red
         
         let chatViewController = ChatListController()

+ 1 - 1
deltachat-ios/AppDelegate.swift

@@ -77,7 +77,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             fatalError("window was nil in app delegate")
         }
         let appCoordinator = AppCoordinator()
-        appCoordinator.setupMainViewControllers(window: window)
+        appCoordinator.setupViewControllers(window: window)
         
     
         

+ 67 - 0
deltachat-ios/ContactViewController.swift

@@ -0,0 +1,67 @@
+//
+//  ContactViewController.swift
+//  deltachat-ios
+//
+//  Created by Bastian van de Wetering on 08.11.17.
+//  Copyright © 2017 Jonas Reinsch. All rights reserved.
+//
+
+import UIKit
+
+class ContactViewController: UIViewController {
+
+    var coordinator: Coordinator
+    var contacts: [Int] = []
+    
+    
+    init(coordinator: Coordinator) {
+        self.coordinator = coordinator
+        super.init(nibName: nil, bundle: nil)
+    }
+    
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+    
+    override func viewWillAppear(_ animated: Bool) {
+        let c_contact = mrmailbox_get_known_contacts(mailboxPointer, nil)
+        
+        let len = carray_count(c_contact)
+        
+        
+        
+        //let con = convert(length: len, data: c_contact)
+        
+        
+        
+    }
+    
+    func convert(length: UInt32, data: UnsafePointer<UInt32>) -> [UInt32] {
+        
+        let buffer = UnsafeBufferPointer(start: data, count: Int(length));
+        return Array(buffer)
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        // Do any additional setup after loading the view.
+    }
+
+    override func didReceiveMemoryWarning() {
+        super.didReceiveMemoryWarning()
+        // Dispose of any resources that can be recreated.
+    }
+    
+
+    /*
+    // MARK: - Navigation
+
+    // In a storyboard-based application, you will often want to do a little preparation before navigation
+    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+        // Get the new view controller using segue.destinationViewController.
+        // Pass the selected object to the new view controller.
+    }
+    */
+
+}

+ 14 - 14
deltachat-ios/ViewController.swift

@@ -8,18 +8,18 @@
 
 import UIKit
 
-class ViewController: UIViewController {
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        // Do any additional setup after loading the view, typically from a nib.
-    }
-
-    override func didReceiveMemoryWarning() {
-        super.didReceiveMemoryWarning()
-        // Dispose of any resources that can be recreated.
-    }
-
-
-}
+//class ViewController: UIViewController {
+//
+//    override func viewDidLoad() {
+//        super.viewDidLoad()
+//        // Do any additional setup after loading the view, typically from a nib.
+//    }
+//
+//    override func didReceiveMemoryWarning() {
+//        super.didReceiveMemoryWarning()
+//        // Dispose of any resources that can be recreated.
+//    }
+//
+//
+//}