{"action":"created","comment":{"url":"https://api.github.com/repos/le-binh/FourSquare/pulls/comments/73638509","id":73638509,"diff_hunk":"@@ -7,18 +7,124 @@\n //\n \n import UIKit\n+import PageMenu\n+import SwiftUtils\n+import LGSideMenuController\n \n-class HomeViewController: UIViewController {\n+enum DefaultMenuItem: Int {\n+    case TopPicks\n+    case Food\n+    case Shops\n \n-    @IBOutlet weak var navigationBarView: UIView!\n-    @IBOutlet weak var sideMenuButton: UIButton!\n-    @IBOutlet weak var listOrMapMenuButton: UIButton!\n+    var title: String {\n+        switch self {\n+        case .TopPicks:\n+            return Strings.MenuItemTopPicks\n+        case .Food:\n+            return Strings.MenuItemFood\n+        case .Shops:\n+            return Strings.MenuItemShops\n+        }\n+    }\n+}\n+\n+class HomeViewController: BaseViewController {\n+\n+    @IBOutlet weak var viewOfPageMenu: UIView!\n+\n+    // MARK:- Properties\n+\n+    var pageMenu: CAPSPageMenu?\n+    var itemViewControllers: [UIViewController] = []\n+    var activeMenuItems: [ItemMenu] = []\n \n-    @IBAction func showSideMenuAction(sender: AnyObject) {\n-        UIApplication.sharedApplication().backgroundViewController()?.showHideLeftViewAnimated(true, completionHandler: nil)\n+    // MARK:- Life Cycle\n+\n+    override func viewDidLoad() {\n+        self.title = \"Explore\"\n+        super.viewDidLoad()\n+        self.itemViewControllers = self.setDefaultMenuItems()\n+        self.setUpMenuPage(isDefault: true)\n+        self.setUpNotificationCenter()\n     }\n \n-    @IBAction func showListOrMapAction(sender: AnyObject) {\n+    // MARK:- Public Functions\n+\n+    // MARK:- Private Function\n+\n+    private func setDefaultMenuItems() -> [UIViewController] {\n+\n+        var viewControllers: [UIViewController] = []\n+\n+        for i in 0..<3 {\n+            let pageViewController = MenuItemViewController.vc()\n+            guard let defaultItemMenu = DefaultMenuItem(rawValue: i) else {\n+                continue\n+            }\n+            pageViewController.title = defaultItemMenu.title\n+            pageViewController.defaultItem = defaultItemMenu\n+            viewControllers.append(pageViewController)\n+        }\n+        return viewControllers\n     }\n \n+    private func setUpMenuPage(isDefault isDefault: Bool) {\n+        var menuItemWidth = (kScreenSize.width - 20) / 3\n+        if !isDefault {\n+            menuItemWidth = (kScreenSize.width - 20) / 3.5\n+        }\n+        let parameters: [CAPSPageMenuOption] = [.MenuHeight(35),\n+                .MenuMargin(5),\n+                .MenuItemWidth(menuItemWidth),\n+                .ScrollMenuBackgroundColor(Color.Gray235),\n+                .SelectionIndicatorColor(Color.Orange253),\n+                .SelectedMenuItemLabelColor(Color.Orange253)]\n+\n+        self.pageMenu = CAPSPageMenu(viewControllers: self.itemViewControllers, frame: self.viewOfPageMenu.frame, pageMenuOptions: parameters)\n+        if let pageMenu = self.pageMenu {\n+            self.view.addSubview(pageMenu.view)\n+        }\n+\n+    }\n+\n+    private func setUpNotificationCenter() {\n+        NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.dismissLeftSideMenu), name: kLGSideMenuControllerWillDismissLeftViewNotification, object: nil)\n+    }\n+\n+    @objc private func dismissLeftSideMenu() {\n+        let newActiveMenuItems = BackgroundViewController.sharedInstance.activeMenuItems","path":"FourSquare/Controllers/Home/HomeViewController.swift","position":96,"original_position":96,"commit_id":"978a0cda7e3a4484d93dbda9fd42bcd2e6b57d6b","original_commit_id":"978a0cda7e3a4484d93dbda9fd42bcd2e6b57d6b","user":{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false},"body":"break down this function into small functions","created_at":"2016-08-05T03:45:28Z","updated_at":"2016-08-05T03:45:28Z","html_url":"https://github.com/le-binh/FourSquare/pull/12#discussion_r73638509","pull_request_url":"https://api.github.com/repos/le-binh/FourSquare/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/le-binh/FourSquare/pulls/comments/73638509"},"html":{"href":"https://github.com/le-binh/FourSquare/pull/12#discussion_r73638509"},"pull_request":{"href":"https://api.github.com/repos/le-binh/FourSquare/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/le-binh/FourSquare/pulls/12","id":80033138,"html_url":"https://github.com/le-binh/FourSquare/pull/12","diff_url":"https://github.com/le-binh/FourSquare/pull/12.diff","patch_url":"https://github.com/le-binh/FourSquare/pull/12.patch","issue_url":"https://api.github.com/repos/le-binh/FourSquare/issues/12","number":12,"state":"open","locked":false,"title":"Feature/create menu bar issue#5","user":{"login":"hovansuit","id":19943832,"avatar_url":"https://avatars.githubusercontent.com/u/19943832?v=3","gravatar_id":"","url":"https://api.github.com/users/hovansuit","html_url":"https://github.com/hovansuit","followers_url":"https://api.github.com/users/hovansuit/followers","following_url":"https://api.github.com/users/hovansuit/following{/other_user}","gists_url":"https://api.github.com/users/hovansuit/gists{/gist_id}","starred_url":"https://api.github.com/users/hovansuit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hovansuit/subscriptions","organizations_url":"https://api.github.com/users/hovansuit/orgs","repos_url":"https://api.github.com/users/hovansuit/repos","events_url":"https://api.github.com/users/hovansuit/events{/privacy}","received_events_url":"https://api.github.com/users/hovansuit/received_events","type":"User","site_admin":false},"body":"#5 : Custom Navigation Bar\r\n#6 : Add Library 'Page Menu' To Project\r\n#6 : Custom Venue Item Cell\r\n#6 : Connected Side Menu And Page Menu When Add Item Menu\r\n","created_at":"2016-08-04T07:50:17Z","updated_at":"2016-08-05T03:45:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f2a3290159afa1cf05725dd8744ac1717517e012","assignee":{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false},"assignees":[{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/le-binh/FourSquare/pulls/12/commits","review_comments_url":"https://api.github.com/repos/le-binh/FourSquare/pulls/12/comments","review_comment_url":"https://api.github.com/repos/le-binh/FourSquare/pulls/comments{/number}","comments_url":"https://api.github.com/repos/le-binh/FourSquare/issues/12/comments","statuses_url":"https://api.github.com/repos/le-binh/FourSquare/statuses/978a0cda7e3a4484d93dbda9fd42bcd2e6b57d6b","head":{"label":"le-binh:feature/create_menu_bar_issue#5","ref":"feature/create_menu_bar_issue#5","sha":"978a0cda7e3a4484d93dbda9fd42bcd2e6b57d6b","user":{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false},"repo":{"id":64450979,"name":"FourSquare","full_name":"le-binh/FourSquare","owner":{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/le-binh/FourSquare","description":null,"fork":false,"url":"https://api.github.com/repos/le-binh/FourSquare","forks_url":"https://api.github.com/repos/le-binh/FourSquare/forks","keys_url":"https://api.github.com/repos/le-binh/FourSquare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/le-binh/FourSquare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/le-binh/FourSquare/teams","hooks_url":"https://api.github.com/repos/le-binh/FourSquare/hooks","issue_events_url":"https://api.github.com/repos/le-binh/FourSquare/issues/events{/number}","events_url":"https://api.github.com/repos/le-binh/FourSquare/events","assignees_url":"https://api.github.com/repos/le-binh/FourSquare/assignees{/user}","branches_url":"https://api.github.com/repos/le-binh/FourSquare/branches{/branch}","tags_url":"https://api.github.com/repos/le-binh/FourSquare/tags","blobs_url":"https://api.github.com/repos/le-binh/FourSquare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/le-binh/FourSquare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/le-binh/FourSquare/git/refs{/sha}","trees_url":"https://api.github.com/repos/le-binh/FourSquare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/le-binh/FourSquare/statuses/{sha}","languages_url":"https://api.github.com/repos/le-binh/FourSquare/languages","stargazers_url":"https://api.github.com/repos/le-binh/FourSquare/stargazers","contributors_url":"https://api.github.com/repos/le-binh/FourSquare/contributors","subscribers_url":"https://api.github.com/repos/le-binh/FourSquare/subscribers","subscription_url":"https://api.github.com/repos/le-binh/FourSquare/subscription","commits_url":"https://api.github.com/repos/le-binh/FourSquare/commits{/sha}","git_commits_url":"https://api.github.com/repos/le-binh/FourSquare/git/commits{/sha}","comments_url":"https://api.github.com/repos/le-binh/FourSquare/comments{/number}","issue_comment_url":"https://api.github.com/repos/le-binh/FourSquare/issues/comments{/number}","contents_url":"https://api.github.com/repos/le-binh/FourSquare/contents/{+path}","compare_url":"https://api.github.com/repos/le-binh/FourSquare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/le-binh/FourSquare/merges","archive_url":"https://api.github.com/repos/le-binh/FourSquare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/le-binh/FourSquare/downloads","issues_url":"https://api.github.com/repos/le-binh/FourSquare/issues{/number}","pulls_url":"https://api.github.com/repos/le-binh/FourSquare/pulls{/number}","milestones_url":"https://api.github.com/repos/le-binh/FourSquare/milestones{/number}","notifications_url":"https://api.github.com/repos/le-binh/FourSquare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/le-binh/FourSquare/labels{/name}","releases_url":"https://api.github.com/repos/le-binh/FourSquare/releases{/id}","deployments_url":"https://api.github.com/repos/le-binh/FourSquare/deployments","created_at":"2016-07-29T04:41:34Z","updated_at":"2016-07-29T07:42:42Z","pushed_at":"2016-08-05T03:05:59Z","git_url":"git://github.com/le-binh/FourSquare.git","ssh_url":"git@github.com:le-binh/FourSquare.git","clone_url":"https://github.com/le-binh/FourSquare.git","svn_url":"https://github.com/le-binh/FourSquare","homepage":null,"size":570,"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":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"le-binh:master","ref":"master","sha":"3e4baa1b01f4c7b78a3cb3679749744fbed27b19","user":{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false},"repo":{"id":64450979,"name":"FourSquare","full_name":"le-binh/FourSquare","owner":{"login":"le-binh","id":8206075,"avatar_url":"https://avatars.githubusercontent.com/u/8206075?v=3","gravatar_id":"","url":"https://api.github.com/users/le-binh","html_url":"https://github.com/le-binh","followers_url":"https://api.github.com/users/le-binh/followers","following_url":"https://api.github.com/users/le-binh/following{/other_user}","gists_url":"https://api.github.com/users/le-binh/gists{/gist_id}","starred_url":"https://api.github.com/users/le-binh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/le-binh/subscriptions","organizations_url":"https://api.github.com/users/le-binh/orgs","repos_url":"https://api.github.com/users/le-binh/repos","events_url":"https://api.github.com/users/le-binh/events{/privacy}","received_events_url":"https://api.github.com/users/le-binh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/le-binh/FourSquare","description":null,"fork":false,"url":"https://api.github.com/repos/le-binh/FourSquare","forks_url":"https://api.github.com/repos/le-binh/FourSquare/forks","keys_url":"https://api.github.com/repos/le-binh/FourSquare/keys{/key_id}","collaborators_url":"https://api.github.com/repos/le-binh/FourSquare/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/le-binh/FourSquare/teams","hooks_url":"https://api.github.com/repos/le-binh/FourSquare/hooks","issue_events_url":"https://api.github.com/repos/le-binh/FourSquare/issues/events{/number}","events_url":"https://api.github.com/repos/le-binh/FourSquare/events","assignees_url":"https://api.github.com/repos/le-binh/FourSquare/assignees{/user}","branches_url":"https://api.github.com/repos/le-binh/FourSquare/branches{/branch}","tags_url":"https://api.github.com/repos/le-binh/FourSquare/tags","blobs_url":"https://api.github.com/repos/le-binh/FourSquare/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/le-binh/FourSquare/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/le-binh/FourSquare/git/refs{/sha}","trees_url":"https://api.github.com/repos/le-binh/FourSquare/git/trees{/sha}","statuses_url":"https://api.github.com/repos/le-binh/FourSquare/statuses/{sha}","languages_url":"https://api.github.com/repos/le-binh/FourSquare/languages","stargazers_url":"https://api.github.com/repos/le-binh/FourSquare/stargazers","contributors_url":"https://api.github.com/repos/le-binh/FourSquare/contributors","subscribers_url":"https://api.github.com/repos/le-binh/FourSquare/subscribers","subscription_url":"https://api.github.com/repos/le-binh/FourSquare/subscription","commits_url":"https://api.github.com/repos/le-binh/FourSquare/commits{/sha}","git_commits_url":"https://api.github.com/repos/le-binh/FourSquare/git/commits{/sha}","comments_url":"https://api.github.com/repos/le-binh/FourSquare/comments{/number}","issue_comment_url":"https://api.github.com/repos/le-binh/FourSquare/issues/comments{/number}","contents_url":"https://api.github.com/repos/le-binh/FourSquare/contents/{+path}","compare_url":"https://api.github.com/repos/le-binh/FourSquare/compare/{base}...{head}","merges_url":"https://api.github.com/repos/le-binh/FourSquare/merges","archive_url":"https://api.github.com/repos/le-binh/FourSquare/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/le-binh/FourSquare/downloads","issues_url":"https://api.github.com/repos/le-binh/FourSquare/issues{/number}","pulls_url":"https://api.github.com/repos/le-binh/FourSquare/pulls{/number}","milestones_url":"https://api.github.com/repos/le-binh/FourSquare/milestones{/number}","notifications_url":"https://api.github.com/repos/le-binh/FourSquare/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/le-binh/FourSquare/labels{/name}","releases_url":"https://api.github.com/repos/le-binh/FourSquare/releases{/id}","deployments_url":"https://api.github.com/repos/le-binh/FourSquare/deployments","created_at":"2016-07-29T04:41:34Z","updated_at":"2016-07-29T07:42:42Z","pushed_at":"2016-08-05T03:05:59Z","git_url":"git://github.com/le-binh/FourSquare.git","ssh_url":"git@github.com:le-binh/FourSquare.git","clone_url":"https://github.com/le-binh/FourSquare.git","svn_url":"https://github.com/le-binh/FourSquare","homepage":null,"size":570,"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":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/le-binh/FourSquare/pulls/12"},"html":{"href":"https://github.com/le-binh/FourSquare/pull/12"},"issue":{"href":"https://api.github.com/repos/le-binh/FourSquare/issues/12"},"comments":{"href":"https://api.github.com/repos/le-binh/FourSquare/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/le-binh/FourSquare/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/le-binh/FourSquare/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/le-binh/FourSquare/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/le-binh/FourSquare/statuses/978a0cda7e3a4484d93dbda9fd42bcd2e6b57d6b"}}}}
{"actor":{"display_login":"le-binh"}}