{"action":"created","comment":{"url":"https://api.github.com/repos/hasanmainul/localChat/pulls/comments/62968433","id":62968433,"diff_hunk":"@@ -24,33 +27,98 @@ class ChatViewController: UIViewController, NumberOfSegmentRequiredDelegate {\n     \n     override func viewWillAppear(animated: Bool) {\n         super.viewWillAppear(true)\n+        \n+        chatUserNameLabel?.text = String(numberOfSegment)\n+        \n+        self.frameView = UIView(frame: CGRectMake(0, 0, self.view.bounds.width, self.view.bounds.height))\n+        \n+        // Observer Methods for keyboard to show and hide\n+        let center: NSNotificationCenter = NSNotificationCenter.defaultCenter()\n+        center.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIKeyboardWillShowNotification, object: nil)\n+        center.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIKeyboardWillHideNotification, object: nil)\n+        \n+        //Segment Control\n         userSegmentControl.removeAllSegments()\n         for count in 0..<numberOfSegment {\n             userSegmentControl.insertSegmentWithTitle(\"BOT\\(count + 1)\", atIndex: count, animated: true)\n         }\n         userSegmentControl.selectedSegmentIndex = 0;\n+        \n+        chatTableView.reloadData()\n     }\n     \n-    func numberOfSegment(checked: Int) {\n-        numberOfSegment = checked\n-        chatUserNameLabel.text = String(checked) // Just for testing delegate\n+    func keyboardWillShow(notification: NSNotification) {\n+        let info = notification.userInfo!\n+        let keyboardSize = (info[UIKeyboardFrameBeginUserInfoKey] as! NSValue).CGRectValue()\n+        let keyboardHeight = keyboardSize.height\n+        let _ = info[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber as CGFloat\n+        \n+        UIView.animateWithDuration(0.25, delay: 0.25, options: UIViewAnimationOptions.CurveEaseInOut, animations: {\n+            self.view.frame = CGRectMake(0, (self.frameView.frame.origin.y - keyboardHeight), self.view.bounds.width, self.view.bounds.height)\n+            }, completion: nil)        \n+    }\n+    \n+    func keyboardWillHide(notification: NSNotification) {\n+        let info = notification.userInfo!\n+        let _ = info[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber as CGFloat\n+        \n+        UIView.animateWithDuration(0.25, delay: 0.25, options: UIViewAnimationOptions.CurveEaseInOut, animations: {\n+            self.view.frame = CGRectMake(0, (self.frameView.frame.origin.y), self.view.bounds.width, self.view.bounds.height)\n+            }, completion: nil)\n     }\n     \n     override func didReceiveMemoryWarning() {\n         super.didReceiveMemoryWarning()\n         // Dispose of any resources that can be recreated.\n     }\n     \n+    override func viewWillDisappear(animated: Bool) {\n+        // release the observer for keyBoard\n+        NSNotificationCenter.defaultCenter().removeObserver(self, name: UIKeyboardWillShowNotification, object: nil)\n+        NSNotificationCenter.defaultCenter().removeObserver(self, name: UIKeyboardWillHideNotification, object: nil)\n+    }\n+    \n+    func textFieldDidEndEditing(textField: UITextField) {\n+        chatText = chatTextField.text!\n+        chatTextField?.text = \"\"\n+    }\n+    \n+    func textFieldShouldReturn(textField: UITextField) -> Bool {\n+        return self.view.endEditing(true)\n+    }\n+    \n+    override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {\n+        self.view.endEditing(true)\n+    }\n+    \n+    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n+        return 30;\n+    }\n+    \n+    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {\n+        if indexPath.row % 2 == 0 {\n+            let cell = tableView.dequeueReusableCellWithIdentifier(\"passiveChatCell\", forIndexPath: indexPath) as! PassiveChatCell\n+            print(chatText)\n+            cell.passiveChatLabel?.text = chatText\n+            return cell\n+        } else {\n+            let cell = tableView.dequeueReusableCellWithIdentifier(\"activeChatCell\", forIndexPath: indexPath) as! ActiveChatCell\n+            print(chatText)\n+            cell.activeChatLabel?.text = chatText\n+            return cell\n+        }\n+    }\n+    \n     // MARK: - Navigation\n \n     // In a storyboard-based application, you will often want to do a little preparation before navigation\n     override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {        \n         if segue.identifier == \"showSetting\" {\n             let nav = segue.destinationViewController as! UINavigationController\n             let settingViewController = nav.topViewController as! SettingViewController\n-            settingViewController.delegate = self\n+            settingViewController.backButtonPressedClosure = { (checkedNumber: Int) -> () in","path":"LocalChat/ChatViewController.swift","position":116,"original_position":116,"commit_id":"c1a9d5df8b1724159cbcbb91784e75daa67cd0b3","original_commit_id":"c1a9d5df8b1724159cbcbb91784e75daa67cd0b3","user":{"login":"jannatulabeda","id":16507531,"avatar_url":"https://avatars.githubusercontent.com/u/16507531?v=3","gravatar_id":"","url":"https://api.github.com/users/jannatulabeda","html_url":"https://github.com/jannatulabeda","followers_url":"https://api.github.com/users/jannatulabeda/followers","following_url":"https://api.github.com/users/jannatulabeda/following{/other_user}","gists_url":"https://api.github.com/users/jannatulabeda/gists{/gist_id}","starred_url":"https://api.github.com/users/jannatulabeda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jannatulabeda/subscriptions","organizations_url":"https://api.github.com/users/jannatulabeda/orgs","repos_url":"https://api.github.com/users/jannatulabeda/repos","events_url":"https://api.github.com/users/jannatulabeda/events{/privacy}","received_events_url":"https://api.github.com/users/jannatulabeda/received_events","type":"User","site_admin":false},"body":"remove space before (checkedNumber: Int)","created_at":"2016-05-12T06:01:19Z","updated_at":"2016-05-12T06:01:19Z","html_url":"https://github.com/hasanmainul/localChat/pull/2#discussion_r62968433","pull_request_url":"https://api.github.com/repos/hasanmainul/localChat/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/hasanmainul/localChat/pulls/comments/62968433"},"html":{"href":"https://github.com/hasanmainul/localChat/pull/2#discussion_r62968433"},"pull_request":{"href":"https://api.github.com/repos/hasanmainul/localChat/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/hasanmainul/localChat/pulls/2","id":69670513,"html_url":"https://github.com/hasanmainul/localChat/pull/2","diff_url":"https://github.com/hasanmainul/localChat/pull/2.diff","patch_url":"https://github.com/hasanmainul/localChat/pull/2.patch","issue_url":"https://api.github.com/repos/hasanmainul/localChat/issues/2","number":2,"state":"open","locked":false,"title":"Text field lifting while keyboard show and Dummy Chat","user":{"login":"hasanmainul","id":13896244,"avatar_url":"https://avatars.githubusercontent.com/u/13896244?v=3","gravatar_id":"","url":"https://api.github.com/users/hasanmainul","html_url":"https://github.com/hasanmainul","followers_url":"https://api.github.com/users/hasanmainul/followers","following_url":"https://api.github.com/users/hasanmainul/following{/other_user}","gists_url":"https://api.github.com/users/hasanmainul/gists{/gist_id}","starred_url":"https://api.github.com/users/hasanmainul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasanmainul/subscriptions","organizations_url":"https://api.github.com/users/hasanmainul/orgs","repos_url":"https://api.github.com/users/hasanmainul/repos","events_url":"https://api.github.com/users/hasanmainul/events{/privacy}","received_events_url":"https://api.github.com/users/hasanmainul/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-11T13:20:14Z","updated_at":"2016-05-12T06:01:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"21cfaaa136c12b977e0479d2a714f55bb6b8de6d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hasanmainul/localChat/pulls/2/commits","review_comments_url":"https://api.github.com/repos/hasanmainul/localChat/pulls/2/comments","review_comment_url":"https://api.github.com/repos/hasanmainul/localChat/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hasanmainul/localChat/issues/2/comments","statuses_url":"https://api.github.com/repos/hasanmainul/localChat/statuses/c1a9d5df8b1724159cbcbb91784e75daa67cd0b3","head":{"label":"hasanmainul:Text_field_lift","ref":"Text_field_lift","sha":"c1a9d5df8b1724159cbcbb91784e75daa67cd0b3","user":{"login":"hasanmainul","id":13896244,"avatar_url":"https://avatars.githubusercontent.com/u/13896244?v=3","gravatar_id":"","url":"https://api.github.com/users/hasanmainul","html_url":"https://github.com/hasanmainul","followers_url":"https://api.github.com/users/hasanmainul/followers","following_url":"https://api.github.com/users/hasanmainul/following{/other_user}","gists_url":"https://api.github.com/users/hasanmainul/gists{/gist_id}","starred_url":"https://api.github.com/users/hasanmainul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasanmainul/subscriptions","organizations_url":"https://api.github.com/users/hasanmainul/orgs","repos_url":"https://api.github.com/users/hasanmainul/repos","events_url":"https://api.github.com/users/hasanmainul/events{/privacy}","received_events_url":"https://api.github.com/users/hasanmainul/received_events","type":"User","site_admin":false},"repo":{"id":58365583,"name":"localChat","full_name":"hasanmainul/localChat","owner":{"login":"hasanmainul","id":13896244,"avatar_url":"https://avatars.githubusercontent.com/u/13896244?v=3","gravatar_id":"","url":"https://api.github.com/users/hasanmainul","html_url":"https://github.com/hasanmainul","followers_url":"https://api.github.com/users/hasanmainul/followers","following_url":"https://api.github.com/users/hasanmainul/following{/other_user}","gists_url":"https://api.github.com/users/hasanmainul/gists{/gist_id}","starred_url":"https://api.github.com/users/hasanmainul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasanmainul/subscriptions","organizations_url":"https://api.github.com/users/hasanmainul/orgs","repos_url":"https://api.github.com/users/hasanmainul/repos","events_url":"https://api.github.com/users/hasanmainul/events{/privacy}","received_events_url":"https://api.github.com/users/hasanmainul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hasanmainul/localChat","description":"","fork":false,"url":"https://api.github.com/repos/hasanmainul/localChat","forks_url":"https://api.github.com/repos/hasanmainul/localChat/forks","keys_url":"https://api.github.com/repos/hasanmainul/localChat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hasanmainul/localChat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hasanmainul/localChat/teams","hooks_url":"https://api.github.com/repos/hasanmainul/localChat/hooks","issue_events_url":"https://api.github.com/repos/hasanmainul/localChat/issues/events{/number}","events_url":"https://api.github.com/repos/hasanmainul/localChat/events","assignees_url":"https://api.github.com/repos/hasanmainul/localChat/assignees{/user}","branches_url":"https://api.github.com/repos/hasanmainul/localChat/branches{/branch}","tags_url":"https://api.github.com/repos/hasanmainul/localChat/tags","blobs_url":"https://api.github.com/repos/hasanmainul/localChat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hasanmainul/localChat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hasanmainul/localChat/git/refs{/sha}","trees_url":"https://api.github.com/repos/hasanmainul/localChat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hasanmainul/localChat/statuses/{sha}","languages_url":"https://api.github.com/repos/hasanmainul/localChat/languages","stargazers_url":"https://api.github.com/repos/hasanmainul/localChat/stargazers","contributors_url":"https://api.github.com/repos/hasanmainul/localChat/contributors","subscribers_url":"https://api.github.com/repos/hasanmainul/localChat/subscribers","subscription_url":"https://api.github.com/repos/hasanmainul/localChat/subscription","commits_url":"https://api.github.com/repos/hasanmainul/localChat/commits{/sha}","git_commits_url":"https://api.github.com/repos/hasanmainul/localChat/git/commits{/sha}","comments_url":"https://api.github.com/repos/hasanmainul/localChat/comments{/number}","issue_comment_url":"https://api.github.com/repos/hasanmainul/localChat/issues/comments{/number}","contents_url":"https://api.github.com/repos/hasanmainul/localChat/contents/{+path}","compare_url":"https://api.github.com/repos/hasanmainul/localChat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hasanmainul/localChat/merges","archive_url":"https://api.github.com/repos/hasanmainul/localChat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hasanmainul/localChat/downloads","issues_url":"https://api.github.com/repos/hasanmainul/localChat/issues{/number}","pulls_url":"https://api.github.com/repos/hasanmainul/localChat/pulls{/number}","milestones_url":"https://api.github.com/repos/hasanmainul/localChat/milestones{/number}","notifications_url":"https://api.github.com/repos/hasanmainul/localChat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hasanmainul/localChat/labels{/name}","releases_url":"https://api.github.com/repos/hasanmainul/localChat/releases{/id}","deployments_url":"https://api.github.com/repos/hasanmainul/localChat/deployments","created_at":"2016-05-09T09:40:01Z","updated_at":"2016-05-09T09:48:16Z","pushed_at":"2016-05-12T05:42:42Z","git_url":"git://github.com/hasanmainul/localChat.git","ssh_url":"git@github.com:hasanmainul/localChat.git","clone_url":"https://github.com/hasanmainul/localChat.git","svn_url":"https://github.com/hasanmainul/localChat","homepage":null,"size":92,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"hasanmainul:master","ref":"master","sha":"0017837ce8488caa8b2a56464c399c01b04f3133","user":{"login":"hasanmainul","id":13896244,"avatar_url":"https://avatars.githubusercontent.com/u/13896244?v=3","gravatar_id":"","url":"https://api.github.com/users/hasanmainul","html_url":"https://github.com/hasanmainul","followers_url":"https://api.github.com/users/hasanmainul/followers","following_url":"https://api.github.com/users/hasanmainul/following{/other_user}","gists_url":"https://api.github.com/users/hasanmainul/gists{/gist_id}","starred_url":"https://api.github.com/users/hasanmainul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasanmainul/subscriptions","organizations_url":"https://api.github.com/users/hasanmainul/orgs","repos_url":"https://api.github.com/users/hasanmainul/repos","events_url":"https://api.github.com/users/hasanmainul/events{/privacy}","received_events_url":"https://api.github.com/users/hasanmainul/received_events","type":"User","site_admin":false},"repo":{"id":58365583,"name":"localChat","full_name":"hasanmainul/localChat","owner":{"login":"hasanmainul","id":13896244,"avatar_url":"https://avatars.githubusercontent.com/u/13896244?v=3","gravatar_id":"","url":"https://api.github.com/users/hasanmainul","html_url":"https://github.com/hasanmainul","followers_url":"https://api.github.com/users/hasanmainul/followers","following_url":"https://api.github.com/users/hasanmainul/following{/other_user}","gists_url":"https://api.github.com/users/hasanmainul/gists{/gist_id}","starred_url":"https://api.github.com/users/hasanmainul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hasanmainul/subscriptions","organizations_url":"https://api.github.com/users/hasanmainul/orgs","repos_url":"https://api.github.com/users/hasanmainul/repos","events_url":"https://api.github.com/users/hasanmainul/events{/privacy}","received_events_url":"https://api.github.com/users/hasanmainul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hasanmainul/localChat","description":"","fork":false,"url":"https://api.github.com/repos/hasanmainul/localChat","forks_url":"https://api.github.com/repos/hasanmainul/localChat/forks","keys_url":"https://api.github.com/repos/hasanmainul/localChat/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hasanmainul/localChat/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hasanmainul/localChat/teams","hooks_url":"https://api.github.com/repos/hasanmainul/localChat/hooks","issue_events_url":"https://api.github.com/repos/hasanmainul/localChat/issues/events{/number}","events_url":"https://api.github.com/repos/hasanmainul/localChat/events","assignees_url":"https://api.github.com/repos/hasanmainul/localChat/assignees{/user}","branches_url":"https://api.github.com/repos/hasanmainul/localChat/branches{/branch}","tags_url":"https://api.github.com/repos/hasanmainul/localChat/tags","blobs_url":"https://api.github.com/repos/hasanmainul/localChat/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hasanmainul/localChat/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hasanmainul/localChat/git/refs{/sha}","trees_url":"https://api.github.com/repos/hasanmainul/localChat/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hasanmainul/localChat/statuses/{sha}","languages_url":"https://api.github.com/repos/hasanmainul/localChat/languages","stargazers_url":"https://api.github.com/repos/hasanmainul/localChat/stargazers","contributors_url":"https://api.github.com/repos/hasanmainul/localChat/contributors","subscribers_url":"https://api.github.com/repos/hasanmainul/localChat/subscribers","subscription_url":"https://api.github.com/repos/hasanmainul/localChat/subscription","commits_url":"https://api.github.com/repos/hasanmainul/localChat/commits{/sha}","git_commits_url":"https://api.github.com/repos/hasanmainul/localChat/git/commits{/sha}","comments_url":"https://api.github.com/repos/hasanmainul/localChat/comments{/number}","issue_comment_url":"https://api.github.com/repos/hasanmainul/localChat/issues/comments{/number}","contents_url":"https://api.github.com/repos/hasanmainul/localChat/contents/{+path}","compare_url":"https://api.github.com/repos/hasanmainul/localChat/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hasanmainul/localChat/merges","archive_url":"https://api.github.com/repos/hasanmainul/localChat/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hasanmainul/localChat/downloads","issues_url":"https://api.github.com/repos/hasanmainul/localChat/issues{/number}","pulls_url":"https://api.github.com/repos/hasanmainul/localChat/pulls{/number}","milestones_url":"https://api.github.com/repos/hasanmainul/localChat/milestones{/number}","notifications_url":"https://api.github.com/repos/hasanmainul/localChat/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hasanmainul/localChat/labels{/name}","releases_url":"https://api.github.com/repos/hasanmainul/localChat/releases{/id}","deployments_url":"https://api.github.com/repos/hasanmainul/localChat/deployments","created_at":"2016-05-09T09:40:01Z","updated_at":"2016-05-09T09:48:16Z","pushed_at":"2016-05-12T05:42:42Z","git_url":"git://github.com/hasanmainul/localChat.git","ssh_url":"git@github.com:hasanmainul/localChat.git","clone_url":"https://github.com/hasanmainul/localChat.git","svn_url":"https://github.com/hasanmainul/localChat","homepage":null,"size":92,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hasanmainul/localChat/pulls/2"},"html":{"href":"https://github.com/hasanmainul/localChat/pull/2"},"issue":{"href":"https://api.github.com/repos/hasanmainul/localChat/issues/2"},"comments":{"href":"https://api.github.com/repos/hasanmainul/localChat/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/hasanmainul/localChat/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/hasanmainul/localChat/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hasanmainul/localChat/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/hasanmainul/localChat/statuses/c1a9d5df8b1724159cbcbb91784e75daa67cd0b3"}}}}