{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/comments/70768853","id":70768853,"diff_hunk":"@@ -0,0 +1,144 @@\n+//\n+//  ContactViewController.swift\n+//  MoneyLove_1\n+//\n+//  Created by macmini-0017 on 7/8/16.\n+//  Copyright © 2016 vantientu. All rights reserved.\n+//\n+\n+import UIKit\n+import Contacts\n+protocol TransactionVCDelegate {\n+    func displayContact(newName:String?)\n+}\n+class ContactViewController: UIViewController {\n+    var contactData:ContactData?\n+    weak var delegate:TransactionViewController?\n+    @IBOutlet weak var myTableView: UITableView!\n+    @IBOutlet weak var contactSearchBar: UISearchBar!\n+    var filtered = [String]()\n+    var data = [String]()\n+    var results = [String]()\n+    var searchActive : Bool = false\n+    \n+    override func viewDidLoad() {\n+        super.viewDidLoad()\n+        contactData = ContactData()\n+        let handleClosure = {(vc:ContactViewController) -> () in\n+            let alertController = UIAlertController(title: nil, message: \"This app previously was refused permissions to contacts; Please go to settings and grant permission to this app so it can use contacts\", preferredStyle: UIAlertControllerStyle.Alert)\n+            let action = UIAlertAction(title: \"OK\", style: UIAlertActionStyle.Default, handler: nil)\n+            alertController .addAction(action)\n+            self .presentViewController(alertController, animated: true, completion: nil)\n+        }\n+        contactData?.handleClosure = handleClosure\n+        contactData?.getDataFromUserContact(self)\n+        contactSearchBar.delegate = self\n+    }\n+    \n+    override func viewWillAppear(animated: Bool) {\n+        super.viewWillAppear(animated)\n+        self.navigationController?.setNavigationBarHidden(false, animated: false)\n+        self.configureNavigationBar()\n+        myTableView .reloadData()\n+    }\n+    \n+    override func didReceiveMemoryWarning() {\n+        super.didReceiveMemoryWarning()\n+        // Dispose of any resources that can be recreated.\n+    }\n+    \n+    func configureNavigationBar() {\n+        let leftButton = UIBarButtonItem(title: \"Back\", style: UIBarButtonItemStyle.Done, target: self, action: #selector(ContactViewController.clickToBack(_:)))\n+        let rightButton = UIBarButtonItem(title:\"Done\", style: UIBarButtonItemStyle.Plain, target: self, action: #selector(ContactViewController.clickToSave(_:)))\n+        self.navigationItem.title = \"WITH\"\n+        self.navigationItem.leftBarButtonItem = leftButton\n+        self.navigationItem.rightBarButtonItem = rightButton\n+    }\n+    \n+    func clickToBack(sender:UIBarButtonItem) {\n+        self.navigationController?.popViewControllerAnimated(true)\n+    }\n+    \n+    func clickToSave(sender:UIBarButtonItem) {\n+        self.delegate?.displayContact(contactSearchBar.text)\n+        self.delegate?.navigationController?.popViewControllerAnimated(true)\n+    }\n+}\n+\n+extension ContactViewController: UITableViewDataSource, UITableViewDelegate {\n+    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n+        return searchActive ? filtered.count : self.contactData!.names.count\n+    }\n+    \n+    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {\n+        var cell = tableView.dequeueReusableCellWithIdentifier(\"cellIdentifier\")\n+        if cell == nil {\n+            cell = UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: \"cellIdentifier\")\n+        }\n+        if searchActive {\n+            let name = self.filtered[indexPath.row]\n+            cell!.textLabel?.text = name\n+        } else {\n+            let name = self.contactData?.data[indexPath.row]\n+            cell!.textLabel?.text = name\n+        }\n+        return cell!\n+        ","path":"MoneyLove_1/Controllers/Transaction/Contact/ContactViewController.swift","position":86,"original_position":86,"commit_id":"116164bbaef57e13eac0f9d4dc7bb7a8ae4c6f1e","original_commit_id":"116164bbaef57e13eac0f9d4dc7bb7a8ae4c6f1e","user":{"login":"quocnb","id":4478445,"avatar_url":"https://avatars.githubusercontent.com/u/4478445?v=3","gravatar_id":"","url":"https://api.github.com/users/quocnb","html_url":"https://github.com/quocnb","followers_url":"https://api.github.com/users/quocnb/followers","following_url":"https://api.github.com/users/quocnb/following{/other_user}","gists_url":"https://api.github.com/users/quocnb/gists{/gist_id}","starred_url":"https://api.github.com/users/quocnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quocnb/subscriptions","organizations_url":"https://api.github.com/users/quocnb/orgs","repos_url":"https://api.github.com/users/quocnb/repos","events_url":"https://api.github.com/users/quocnb/events{/privacy}","received_events_url":"https://api.github.com/users/quocnb/received_events","type":"User","site_admin":false},"body":"convention","created_at":"2016-07-14T08:37:51Z","updated_at":"2016-07-14T08:37:51Z","html_url":"https://github.com/framgia/MoneyLove_1/pull/12#discussion_r70768853","pull_request_url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/comments/70768853"},"html":{"href":"https://github.com/framgia/MoneyLove_1/pull/12#discussion_r70768853"},"pull_request":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12","id":77403555,"html_url":"https://github.com/framgia/MoneyLove_1/pull/12","diff_url":"https://github.com/framgia/MoneyLove_1/pull/12.diff","patch_url":"https://github.com/framgia/MoneyLove_1/pull/12.patch","issue_url":"https://api.github.com/repos/framgia/MoneyLove_1/issues/12","number":12,"state":"open","locked":false,"title":"create view controller transactions","user":{"login":"doquanghuy","id":9291831,"avatar_url":"https://avatars.githubusercontent.com/u/9291831?v=3","gravatar_id":"","url":"https://api.github.com/users/doquanghuy","html_url":"https://github.com/doquanghuy","followers_url":"https://api.github.com/users/doquanghuy/followers","following_url":"https://api.github.com/users/doquanghuy/following{/other_user}","gists_url":"https://api.github.com/users/doquanghuy/gists{/gist_id}","starred_url":"https://api.github.com/users/doquanghuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doquanghuy/subscriptions","organizations_url":"https://api.github.com/users/doquanghuy/orgs","repos_url":"https://api.github.com/users/doquanghuy/repos","events_url":"https://api.github.com/users/doquanghuy/events{/privacy}","received_events_url":"https://api.github.com/users/doquanghuy/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-14T05:59:52Z","updated_at":"2016-07-14T08:37:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"efc2fd28c2d40b5a53e433b11901baae8bb1815a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12/commits","review_comments_url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12/comments","review_comment_url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/MoneyLove_1/issues/12/comments","statuses_url":"https://api.github.com/repos/framgia/MoneyLove_1/statuses/116164bbaef57e13eac0f9d4dc7bb7a8ae4c6f1e","head":{"label":"doquanghuy:create_transaction_view_controller","ref":"create_transaction_view_controller","sha":"116164bbaef57e13eac0f9d4dc7bb7a8ae4c6f1e","user":{"login":"doquanghuy","id":9291831,"avatar_url":"https://avatars.githubusercontent.com/u/9291831?v=3","gravatar_id":"","url":"https://api.github.com/users/doquanghuy","html_url":"https://github.com/doquanghuy","followers_url":"https://api.github.com/users/doquanghuy/followers","following_url":"https://api.github.com/users/doquanghuy/following{/other_user}","gists_url":"https://api.github.com/users/doquanghuy/gists{/gist_id}","starred_url":"https://api.github.com/users/doquanghuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doquanghuy/subscriptions","organizations_url":"https://api.github.com/users/doquanghuy/orgs","repos_url":"https://api.github.com/users/doquanghuy/repos","events_url":"https://api.github.com/users/doquanghuy/events{/privacy}","received_events_url":"https://api.github.com/users/doquanghuy/received_events","type":"User","site_admin":false},"repo":{"id":62687089,"name":"MoneyLove_1","full_name":"doquanghuy/MoneyLove_1","owner":{"login":"doquanghuy","id":9291831,"avatar_url":"https://avatars.githubusercontent.com/u/9291831?v=3","gravatar_id":"","url":"https://api.github.com/users/doquanghuy","html_url":"https://github.com/doquanghuy","followers_url":"https://api.github.com/users/doquanghuy/followers","following_url":"https://api.github.com/users/doquanghuy/following{/other_user}","gists_url":"https://api.github.com/users/doquanghuy/gists{/gist_id}","starred_url":"https://api.github.com/users/doquanghuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doquanghuy/subscriptions","organizations_url":"https://api.github.com/users/doquanghuy/orgs","repos_url":"https://api.github.com/users/doquanghuy/repos","events_url":"https://api.github.com/users/doquanghuy/events{/privacy}","received_events_url":"https://api.github.com/users/doquanghuy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/doquanghuy/MoneyLove_1","description":"Money Love (training)","fork":true,"url":"https://api.github.com/repos/doquanghuy/MoneyLove_1","forks_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/forks","keys_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/teams","hooks_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/hooks","issue_events_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/issues/events{/number}","events_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/events","assignees_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/assignees{/user}","branches_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/branches{/branch}","tags_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/tags","blobs_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/git/refs{/sha}","trees_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/statuses/{sha}","languages_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/languages","stargazers_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/stargazers","contributors_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/contributors","subscribers_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/subscribers","subscription_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/subscription","commits_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/commits{/sha}","git_commits_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/git/commits{/sha}","comments_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/comments{/number}","issue_comment_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/issues/comments{/number}","contents_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/contents/{+path}","compare_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/merges","archive_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/downloads","issues_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/issues{/number}","pulls_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/pulls{/number}","milestones_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/milestones{/number}","notifications_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/labels{/name}","releases_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/releases{/id}","deployments_url":"https://api.github.com/repos/doquanghuy/MoneyLove_1/deployments","created_at":"2016-07-06T03:08:00Z","updated_at":"2016-07-06T02:18:56Z","pushed_at":"2016-07-14T08:11:09Z","git_url":"git://github.com/doquanghuy/MoneyLove_1.git","ssh_url":"git@github.com:doquanghuy/MoneyLove_1.git","clone_url":"https://github.com/doquanghuy/MoneyLove_1.git","svn_url":"https://github.com/doquanghuy/MoneyLove_1","homepage":null,"size":258,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"framgia:develop","ref":"develop","sha":"7ec0ba254bd24617b2139a299b02b19acccb3174","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":62684221,"name":"MoneyLove_1","full_name":"framgia/MoneyLove_1","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/MoneyLove_1","description":"Money Love (training)","fork":false,"url":"https://api.github.com/repos/framgia/MoneyLove_1","forks_url":"https://api.github.com/repos/framgia/MoneyLove_1/forks","keys_url":"https://api.github.com/repos/framgia/MoneyLove_1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/MoneyLove_1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/MoneyLove_1/teams","hooks_url":"https://api.github.com/repos/framgia/MoneyLove_1/hooks","issue_events_url":"https://api.github.com/repos/framgia/MoneyLove_1/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/MoneyLove_1/events","assignees_url":"https://api.github.com/repos/framgia/MoneyLove_1/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/MoneyLove_1/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/MoneyLove_1/tags","blobs_url":"https://api.github.com/repos/framgia/MoneyLove_1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/MoneyLove_1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/MoneyLove_1/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/MoneyLove_1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/MoneyLove_1/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/MoneyLove_1/languages","stargazers_url":"https://api.github.com/repos/framgia/MoneyLove_1/stargazers","contributors_url":"https://api.github.com/repos/framgia/MoneyLove_1/contributors","subscribers_url":"https://api.github.com/repos/framgia/MoneyLove_1/subscribers","subscription_url":"https://api.github.com/repos/framgia/MoneyLove_1/subscription","commits_url":"https://api.github.com/repos/framgia/MoneyLove_1/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/MoneyLove_1/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/MoneyLove_1/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/MoneyLove_1/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/MoneyLove_1/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/MoneyLove_1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/MoneyLove_1/merges","archive_url":"https://api.github.com/repos/framgia/MoneyLove_1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/MoneyLove_1/downloads","issues_url":"https://api.github.com/repos/framgia/MoneyLove_1/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/MoneyLove_1/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/MoneyLove_1/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/MoneyLove_1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/MoneyLove_1/labels{/name}","releases_url":"https://api.github.com/repos/framgia/MoneyLove_1/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/MoneyLove_1/deployments","created_at":"2016-07-06T02:18:56Z","updated_at":"2016-07-06T02:18:56Z","pushed_at":"2016-07-14T08:11:49Z","git_url":"git://github.com/framgia/MoneyLove_1.git","ssh_url":"git@github.com:framgia/MoneyLove_1.git","clone_url":"https://github.com/framgia/MoneyLove_1.git","svn_url":"https://github.com/framgia/MoneyLove_1","homepage":null,"size":261,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12"},"html":{"href":"https://github.com/framgia/MoneyLove_1/pull/12"},"issue":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/issues/12"},"comments":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/MoneyLove_1/statuses/116164bbaef57e13eac0f9d4dc7bb7a8ae4c6f1e"}}}}
{"actor":{"display_login":"quocnb"}}