{"action":"created","comment":{"url":"https://api.github.com/repos/systers/volunteers-iOS/pulls/comments/132546614","pull_request_review_id":55635986,"id":132546614,"diff_hunk":"@@ -76,36 +78,98 @@ extension LoginsManagerTableViewController {\n                 // Can only remove login if there is more than one\n                 removeConnectedLoginUpdateTable(provider)\n             } else {\n-                showErrorAlert(errorTitle: minimumLoginsTitleKey.localized,\n+                showErrorAlert(errorTitle: removeLoginErrorKey.localized,\n                                errorMessage: VLError.minimumConnectedLogins.localizedDescription)\n             }\n         } else {\n             switch provider {\n             case .google:\n                 GIDSignIn.sharedInstance().signIn()\n-            case .email, .facebook:\n-                // TODO: Handle connected login case for email and facebook\n-                break\n+            case .facebook:\n+                FBSDKLoginManager().logIn(withReadPermissions: FBRequest.readPermissions, from: self, handler: { (_, error) in\n+                    guard error == nil else {\n+                        let fbError = error ?? AuthenticationError.invalidFacebookToken\n+                        Logger.error(fbError)\n+                        return\n+                    }\n+\n+                    self.addConnectedLogin(.facebook)\n+                })\n+            case .email:\n+                let connectVC: ConnectEmailViewController = UIStoryboard(.login).instantiateViewController()\n+                connectVC.delegate = self\n+                show(connectVC, sender: self)\n             }\n         }\n     }\n \n-    /// Removes a connected login from account and reflect changes in table\n+    /**\n+        Add a connected login to Firebase account given a `strategy`. Update tableview\n+        display if connection was successful.\n+     \n+        - Parameters:\n+            - strategy: Strategy to add connected login by (email, facebook, etc)\n+    */\n+    func addConnectedLogin(_ strategy: AvailableConnectLoginStrategies) {\n+        displayActivityIndicator()\n+        LoginManager.shared.addConnectedLogin(strategy)\n+            .then { [weak self] _ -> Void in\n+                guard let `self` = self else {\n+                    return\n+                }\n+\n+                self.tableView.reloadData()\n+            }.always { [weak self] in","path":"VOLA/VOLA/ViewControllers/LoginsManagerTableViewController.swift","position":62,"original_position":62,"commit_id":"fb412203faf2bca46b2e492d4c71cecbb5ff54b6","original_commit_id":"fb412203faf2bca46b2e492d4c71cecbb5ff54b6","user":{"login":"bphenriques","id":4727729,"avatar_url":"https://avatars3.githubusercontent.com/u/4727729?v=4","gravatar_id":"","url":"https://api.github.com/users/bphenriques","html_url":"https://github.com/bphenriques","followers_url":"https://api.github.com/users/bphenriques/followers","following_url":"https://api.github.com/users/bphenriques/following{/other_user}","gists_url":"https://api.github.com/users/bphenriques/gists{/gist_id}","starred_url":"https://api.github.com/users/bphenriques/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bphenriques/subscriptions","organizations_url":"https://api.github.com/users/bphenriques/orgs","repos_url":"https://api.github.com/users/bphenriques/repos","events_url":"https://api.github.com/users/bphenriques/events{/privacy}","received_events_url":"https://api.github.com/users/bphenriques/received_events","type":"User","site_admin":false},"body":"I usually move the `always` after the `catch` so that the logic is is aligned with what we usually see on other languages","created_at":"2017-08-10T19:30:16Z","updated_at":"2017-08-10T19:33:29Z","html_url":"https://github.com/systers/volunteers-iOS/pull/29#discussion_r132546614","pull_request_url":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29","_links":{"self":{"href":"https://api.github.com/repos/systers/volunteers-iOS/pulls/comments/132546614"},"html":{"href":"https://github.com/systers/volunteers-iOS/pull/29#discussion_r132546614"},"pull_request":{"href":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29"}}},"pull_request":{"url":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29","id":135169708,"html_url":"https://github.com/systers/volunteers-iOS/pull/29","diff_url":"https://github.com/systers/volunteers-iOS/pull/29.diff","patch_url":"https://github.com/systers/volunteers-iOS/pull/29.patch","issue_url":"https://api.github.com/repos/systers/volunteers-iOS/issues/29","number":29,"state":"open","locked":false,"title":"Week 10b - Connected login and custom user in Firebase database","user":{"login":"connienguyen","id":7198058,"avatar_url":"https://avatars2.githubusercontent.com/u/7198058?v=4","gravatar_id":"","url":"https://api.github.com/users/connienguyen","html_url":"https://github.com/connienguyen","followers_url":"https://api.github.com/users/connienguyen/followers","following_url":"https://api.github.com/users/connienguyen/following{/other_user}","gists_url":"https://api.github.com/users/connienguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/connienguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connienguyen/subscriptions","organizations_url":"https://api.github.com/users/connienguyen/orgs","repos_url":"https://api.github.com/users/connienguyen/repos","events_url":"https://api.github.com/users/connienguyen/events{/privacy}","received_events_url":"https://api.github.com/users/connienguyen/received_events","type":"User","site_admin":false},"body":"+ Added functionality to connect Facebook and email/password logins\r\n+ Show activity indicator to improve UI feedback on potentially long requests (login/add connected login/remove connected login)\r\n+ Add creating/retrieving custom user data from Firebase database on sign up/login\r\n+ Migrated from Firebase 3.15.0 to 4.0.0 to fix bug where list of connected logins was not updated when email/password login was added","created_at":"2017-08-10T16:34:29Z","updated_at":"2017-08-10T19:33:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fcbb65a63d68dd86fa80700e7d498ce2dfb62ad1","assignee":null,"assignees":[],"requested_reviewers":[{"login":"psok","id":1592565,"avatar_url":"https://avatars3.githubusercontent.com/u/1592565?v=4","gravatar_id":"","url":"https://api.github.com/users/psok","html_url":"https://github.com/psok","followers_url":"https://api.github.com/users/psok/followers","following_url":"https://api.github.com/users/psok/following{/other_user}","gists_url":"https://api.github.com/users/psok/gists{/gist_id}","starred_url":"https://api.github.com/users/psok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psok/subscriptions","organizations_url":"https://api.github.com/users/psok/orgs","repos_url":"https://api.github.com/users/psok/repos","events_url":"https://api.github.com/users/psok/events{/privacy}","received_events_url":"https://api.github.com/users/psok/received_events","type":"User","site_admin":false},{"login":"shruti-gupta","id":3852755,"avatar_url":"https://avatars1.githubusercontent.com/u/3852755?v=4","gravatar_id":"","url":"https://api.github.com/users/shruti-gupta","html_url":"https://github.com/shruti-gupta","followers_url":"https://api.github.com/users/shruti-gupta/followers","following_url":"https://api.github.com/users/shruti-gupta/following{/other_user}","gists_url":"https://api.github.com/users/shruti-gupta/gists{/gist_id}","starred_url":"https://api.github.com/users/shruti-gupta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shruti-gupta/subscriptions","organizations_url":"https://api.github.com/users/shruti-gupta/orgs","repos_url":"https://api.github.com/users/shruti-gupta/repos","events_url":"https://api.github.com/users/shruti-gupta/events{/privacy}","received_events_url":"https://api.github.com/users/shruti-gupta/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29/commits","review_comments_url":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29/comments","review_comment_url":"https://api.github.com/repos/systers/volunteers-iOS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systers/volunteers-iOS/issues/29/comments","statuses_url":"https://api.github.com/repos/systers/volunteers-iOS/statuses/fb412203faf2bca46b2e492d4c71cecbb5ff54b6","head":{"label":"connienguyen:week-10b","ref":"week-10b","sha":"fb412203faf2bca46b2e492d4c71cecbb5ff54b6","user":{"login":"connienguyen","id":7198058,"avatar_url":"https://avatars2.githubusercontent.com/u/7198058?v=4","gravatar_id":"","url":"https://api.github.com/users/connienguyen","html_url":"https://github.com/connienguyen","followers_url":"https://api.github.com/users/connienguyen/followers","following_url":"https://api.github.com/users/connienguyen/following{/other_user}","gists_url":"https://api.github.com/users/connienguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/connienguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connienguyen/subscriptions","organizations_url":"https://api.github.com/users/connienguyen/orgs","repos_url":"https://api.github.com/users/connienguyen/repos","events_url":"https://api.github.com/users/connienguyen/events{/privacy}","received_events_url":"https://api.github.com/users/connienguyen/received_events","type":"User","site_admin":false},"repo":{"id":93987175,"name":"volunteers-iOS","full_name":"connienguyen/volunteers-iOS","owner":{"login":"connienguyen","id":7198058,"avatar_url":"https://avatars2.githubusercontent.com/u/7198058?v=4","gravatar_id":"","url":"https://api.github.com/users/connienguyen","html_url":"https://github.com/connienguyen","followers_url":"https://api.github.com/users/connienguyen/followers","following_url":"https://api.github.com/users/connienguyen/following{/other_user}","gists_url":"https://api.github.com/users/connienguyen/gists{/gist_id}","starred_url":"https://api.github.com/users/connienguyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connienguyen/subscriptions","organizations_url":"https://api.github.com/users/connienguyen/orgs","repos_url":"https://api.github.com/users/connienguyen/repos","events_url":"https://api.github.com/users/connienguyen/events{/privacy}","received_events_url":"https://api.github.com/users/connienguyen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/connienguyen/volunteers-iOS","description":null,"fork":true,"url":"https://api.github.com/repos/connienguyen/volunteers-iOS","forks_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/forks","keys_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/teams","hooks_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/hooks","issue_events_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/events","assignees_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/tags","blobs_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/languages","stargazers_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/stargazers","contributors_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/contributors","subscribers_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/subscribers","subscription_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/subscription","commits_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/merges","archive_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/downloads","issues_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/labels{/name}","releases_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/releases{/id}","deployments_url":"https://api.github.com/repos/connienguyen/volunteers-iOS/deployments","created_at":"2017-06-11T06:53:42Z","updated_at":"2017-08-10T15:49:12Z","pushed_at":"2017-08-10T16:22:23Z","git_url":"git://github.com/connienguyen/volunteers-iOS.git","ssh_url":"git@github.com:connienguyen/volunteers-iOS.git","clone_url":"https://github.com/connienguyen/volunteers-iOS.git","svn_url":"https://github.com/connienguyen/volunteers-iOS","homepage":null,"size":453,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":false,"has_projects":true,"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":"development"}},"base":{"label":"systers:development","ref":"development","sha":"d059e3ab81e25c0cba9dfd4b513082ae9241ab7f","user":{"login":"systers","id":6520415,"avatar_url":"https://avatars0.githubusercontent.com/u/6520415?v=4","gravatar_id":"","url":"https://api.github.com/users/systers","html_url":"https://github.com/systers","followers_url":"https://api.github.com/users/systers/followers","following_url":"https://api.github.com/users/systers/following{/other_user}","gists_url":"https://api.github.com/users/systers/gists{/gist_id}","starred_url":"https://api.github.com/users/systers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systers/subscriptions","organizations_url":"https://api.github.com/users/systers/orgs","repos_url":"https://api.github.com/users/systers/repos","events_url":"https://api.github.com/users/systers/events{/privacy}","received_events_url":"https://api.github.com/users/systers/received_events","type":"Organization","site_admin":false},"repo":{"id":91074876,"name":"volunteers-iOS","full_name":"systers/volunteers-iOS","owner":{"login":"systers","id":6520415,"avatar_url":"https://avatars0.githubusercontent.com/u/6520415?v=4","gravatar_id":"","url":"https://api.github.com/users/systers","html_url":"https://github.com/systers","followers_url":"https://api.github.com/users/systers/followers","following_url":"https://api.github.com/users/systers/following{/other_user}","gists_url":"https://api.github.com/users/systers/gists{/gist_id}","starred_url":"https://api.github.com/users/systers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systers/subscriptions","organizations_url":"https://api.github.com/users/systers/orgs","repos_url":"https://api.github.com/users/systers/repos","events_url":"https://api.github.com/users/systers/events{/privacy}","received_events_url":"https://api.github.com/users/systers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systers/volunteers-iOS","description":null,"fork":false,"url":"https://api.github.com/repos/systers/volunteers-iOS","forks_url":"https://api.github.com/repos/systers/volunteers-iOS/forks","keys_url":"https://api.github.com/repos/systers/volunteers-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systers/volunteers-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systers/volunteers-iOS/teams","hooks_url":"https://api.github.com/repos/systers/volunteers-iOS/hooks","issue_events_url":"https://api.github.com/repos/systers/volunteers-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/systers/volunteers-iOS/events","assignees_url":"https://api.github.com/repos/systers/volunteers-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/systers/volunteers-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/systers/volunteers-iOS/tags","blobs_url":"https://api.github.com/repos/systers/volunteers-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systers/volunteers-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systers/volunteers-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/systers/volunteers-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systers/volunteers-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/systers/volunteers-iOS/languages","stargazers_url":"https://api.github.com/repos/systers/volunteers-iOS/stargazers","contributors_url":"https://api.github.com/repos/systers/volunteers-iOS/contributors","subscribers_url":"https://api.github.com/repos/systers/volunteers-iOS/subscribers","subscription_url":"https://api.github.com/repos/systers/volunteers-iOS/subscription","commits_url":"https://api.github.com/repos/systers/volunteers-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/systers/volunteers-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/systers/volunteers-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/systers/volunteers-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/systers/volunteers-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/systers/volunteers-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systers/volunteers-iOS/merges","archive_url":"https://api.github.com/repos/systers/volunteers-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systers/volunteers-iOS/downloads","issues_url":"https://api.github.com/repos/systers/volunteers-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/systers/volunteers-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/systers/volunteers-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/systers/volunteers-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systers/volunteers-iOS/labels{/name}","releases_url":"https://api.github.com/repos/systers/volunteers-iOS/releases{/id}","deployments_url":"https://api.github.com/repos/systers/volunteers-iOS/deployments","created_at":"2017-05-12T09:28:04Z","updated_at":"2017-05-24T16:52:31Z","pushed_at":"2017-08-10T16:34:30Z","git_url":"git://github.com/systers/volunteers-iOS.git","ssh_url":"git@github.com:systers/volunteers-iOS.git","clone_url":"https://github.com/systers/volunteers-iOS.git","svn_url":"https://github.com/systers/volunteers-iOS","homepage":null,"size":424,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29"},"html":{"href":"https://github.com/systers/volunteers-iOS/pull/29"},"issue":{"href":"https://api.github.com/repos/systers/volunteers-iOS/issues/29"},"comments":{"href":"https://api.github.com/repos/systers/volunteers-iOS/issues/29/comments"},"review_comments":{"href":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29/comments"},"review_comment":{"href":"https://api.github.com/repos/systers/volunteers-iOS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systers/volunteers-iOS/pulls/29/commits"},"statuses":{"href":"https://api.github.com/repos/systers/volunteers-iOS/statuses/fb412203faf2bca46b2e492d4c71cecbb5ff54b6"}}}}
{"actor":{"display_login":"bphenriques"}}