{"action":"created","comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments/28208037","id":28208037,"diff_hunk":"@@ -0,0 +1,125 @@\n+#import \"LoginFacade.h\"\n+#import \"LoginFields.h\"\n+#import \"NSString+Helpers.h\"\n+#import \"NSURL+IDN.h\"\n+#import \"WordPressComOAuthClientFacade.h\"\n+#import \"WordPressXMLRPCApiFacade.h\"\n+\n+\n+@interface LoginFacade () {\n+    id<LoginFacadeDelegate> _delegate;\n+    id<WordPressComOAuthClientFacade> _wordpressComOAuthClientFacade;\n+    id<WordPressXMLRPCApiFacade> _wordpressXMLRPCApiFacade;\n+}\n+\n+@end\n+\n+\n+@implementation LoginFacade\n+\n+- (instancetype)init\n+{\n+    self = [super init];\n+    if (self) {\n+        [self initializeServices];\n+    }\n+    return self;\n+}\n+\n+- (void)initializeServices\n+{\n+    _wordpressComOAuthClientFacade = [WordPressComOAuthClientFacade new];\n+    _wordpressXMLRPCApiFacade = [WordPressXMLRPCApiFacade new];\n+}\n+\n+- (id<LoginFacadeDelegate>)delegate {\n+    return _delegate;\n+}\n+\n+- (void)setDelegate:(id<LoginFacadeDelegate>)delegate\n+{\n+    _delegate = delegate;\n+}\n+\n+- (id<WordPressComOAuthClientFacade>)wordpressComOAuthClientFacade\n+{\n+    return _wordpressComOAuthClientFacade;\n+}\n+\n+- (void)setWordpressComOAuthClientFacade:(id<WordPressComOAuthClientFacade>)wordpressComOAuthClientService\n+{\n+    _wordpressComOAuthClientFacade = wordpressComOAuthClientService;\n+}\n+\n+- (id<WordPressXMLRPCApiFacade>)wordpressXMLRPCApiFacade","path":"WordPress/Classes/Services/LoginFacade.m","position":54,"original_position":54,"commit_id":"f3bd3ee3f23a7100131f8754308232f09c6eaa9e","original_commit_id":"f3bd3ee3f23a7100131f8754308232f09c6eaa9e","user":{"login":"SergioEstevao","id":651601,"avatar_url":"https://avatars.githubusercontent.com/u/651601?v=3","gravatar_id":"","url":"https://api.github.com/users/SergioEstevao","html_url":"https://github.com/SergioEstevao","followers_url":"https://api.github.com/users/SergioEstevao/followers","following_url":"https://api.github.com/users/SergioEstevao/following{/other_user}","gists_url":"https://api.github.com/users/SergioEstevao/gists{/gist_id}","starred_url":"https://api.github.com/users/SergioEstevao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergioEstevao/subscriptions","organizations_url":"https://api.github.com/users/SergioEstevao/orgs","repos_url":"https://api.github.com/users/SergioEstevao/repos","events_url":"https://api.github.com/users/SergioEstevao/events{/privacy}","received_events_url":"https://api.github.com/users/SergioEstevao/received_events","type":"User","site_admin":false},"body":"if you capitalise XML and RPC on the name maybe Api should also be capitalized?","created_at":"2015-04-12T22:04:41Z","updated_at":"2015-04-12T22:04:41Z","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512#discussion_r28208037","pull_request_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512","_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments/28208037"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512#discussion_r28208037"},"pull_request":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512"}}},"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512","id":33017205,"html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512","diff_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512.diff","patch_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512.patch","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512","number":3512,"state":"open","locked":false,"title":"Clean up the LoginViewController and make it more testable","user":{"login":"sendhil","id":437043,"avatar_url":"https://avatars.githubusercontent.com/u/437043?v=3","gravatar_id":"","url":"https://api.github.com/users/sendhil","html_url":"https://github.com/sendhil","followers_url":"https://api.github.com/users/sendhil/followers","following_url":"https://api.github.com/users/sendhil/following{/other_user}","gists_url":"https://api.github.com/users/sendhil/gists{/gist_id}","starred_url":"https://api.github.com/users/sendhil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sendhil/subscriptions","organizations_url":"https://api.github.com/users/sendhil/orgs","repos_url":"https://api.github.com/users/sendhil/repos","events_url":"https://api.github.com/users/sendhil/events{/privacy}","received_events_url":"https://api.github.com/users/sendhil/received_events","type":"User","site_admin":false},"body":"## Overview\r\n\r\nI set out with the goal of making the `LoginViewController` more testable and I thought I would use the MVVM pattern to accomplish this. Most of the logic for `LoginViewController` has been pulled out into `LoginViewModel`. To make `LoginViewModel` more testable I created a few Facade classes to separate concerns and to better allow the `LoginViewModel`'s code to be isolated during unit tests. I created:\r\n\r\n* AccountServiceFacade\r\n* BlogSyncFacade\r\n* HelpshiftFacade\r\n* LoginFacade\r\n* OnePasswordFacade\r\n* ReachabilityFacade\r\n* WordPressComOAuthClientFacade\r\n* WordPressXMLRPCApiFacade\r\n\r\nThe facade classes aren't mean to be permanent, they are more temporary classes to allow for better unit testing. I created them because the classes they hide weren't very easy to test and I didn't want to go in and edit them for this PR as that would have made this PR even larger and it's something I think that can be saved for another day.\r\n\r\n## Added Dependencies:\r\n\r\n* <a href=\"https://github.com/ReactiveCocoa/ReactiveCocoa\">ReactiveCocoa</a> - I added this library because it has some things in it that make the MVVM pattern a lot easier. Specifically the `RAC` macro combined with the `rac_textSignalSelector` to watch updates to a text field, the `RACObserve` macro to watch updates to a specific property, and the `[RACSignal combineLatest:...]` method to allow us to observe multiple properties at the same time.\r\n* I added in <a href=\"https://github.com/specta/specta\">Specta</a>/<a href=\"https://github.com/specta/expecta\">Expecta</a> to take advantage of BDD style testing as I believe it results in easier to read unit tests than what we would get out of XCTest.\r\n\r\nThis is a big PR so the more eyes the merrier - cc @diegoreymendez, @SergioEstevao , @jleandroperez , @koke , @astralbodies .","created_at":"2015-04-10T04:22:52Z","updated_at":"2015-04-12T22:04:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"638e137e4dd7fceaf284bb52f591cd4a6ad3df0d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512/commits","review_comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512/comments","review_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512/comments","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/f3bd3ee3f23a7100131f8754308232f09c6eaa9e","head":{"label":"wordpress-mobile:issue/redo-login-view-with-mvvm","ref":"issue/redo-login-view-with-mvvm","sha":"f3bd3ee3f23a7100131f8754308232f09c6eaa9e","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":8859285,"name":"WordPress-iOS","full_name":"wordpress-mobile/WordPress-iOS","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-iOS","description":"WordPress for iOS - Official repository","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/releases{/id}","created_at":"2013-03-18T16:59:33Z","updated_at":"2015-04-12T12:20:54Z","pushed_at":"2015-04-11T01:08:47Z","git_url":"git://github.com/wordpress-mobile/WordPress-iOS.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-iOS.git","clone_url":"https://github.com/wordpress-mobile/WordPress-iOS.git","svn_url":"https://github.com/wordpress-mobile/WordPress-iOS","homepage":"http://ios.wordpress.org/","size":379741,"stargazers_count":571,"watchers_count":571,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":291,"mirror_url":null,"open_issues_count":350,"forks":291,"open_issues":350,"watchers":571,"default_branch":"develop"}},"base":{"label":"wordpress-mobile:develop","ref":"develop","sha":"4d2bc704781a22693002e642a631fffb152de59c","user":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"repo":{"id":8859285,"name":"WordPress-iOS","full_name":"wordpress-mobile/WordPress-iOS","owner":{"login":"wordpress-mobile","id":1306301,"avatar_url":"https://avatars.githubusercontent.com/u/1306301?v=3","gravatar_id":"","url":"https://api.github.com/users/wordpress-mobile","html_url":"https://github.com/wordpress-mobile","followers_url":"https://api.github.com/users/wordpress-mobile/followers","following_url":"https://api.github.com/users/wordpress-mobile/following{/other_user}","gists_url":"https://api.github.com/users/wordpress-mobile/gists{/gist_id}","starred_url":"https://api.github.com/users/wordpress-mobile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wordpress-mobile/subscriptions","organizations_url":"https://api.github.com/users/wordpress-mobile/orgs","repos_url":"https://api.github.com/users/wordpress-mobile/repos","events_url":"https://api.github.com/users/wordpress-mobile/events{/privacy}","received_events_url":"https://api.github.com/users/wordpress-mobile/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wordpress-mobile/WordPress-iOS","description":"WordPress for iOS - Official repository","fork":false,"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS","forks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/forks","keys_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/teams","hooks_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/hooks","issue_events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/events","assignees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/tags","blobs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/languages","stargazers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/stargazers","contributors_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contributors","subscribers_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscribers","subscription_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/subscription","commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/merges","archive_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/downloads","issues_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/labels{/name}","releases_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/releases{/id}","created_at":"2013-03-18T16:59:33Z","updated_at":"2015-04-12T12:20:54Z","pushed_at":"2015-04-11T01:08:47Z","git_url":"git://github.com/wordpress-mobile/WordPress-iOS.git","ssh_url":"git@github.com:wordpress-mobile/WordPress-iOS.git","clone_url":"https://github.com/wordpress-mobile/WordPress-iOS.git","svn_url":"https://github.com/wordpress-mobile/WordPress-iOS","homepage":"http://ios.wordpress.org/","size":379741,"stargazers_count":571,"watchers_count":571,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":291,"mirror_url":null,"open_issues_count":350,"forks":291,"open_issues":350,"watchers":571,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512"},"html":{"href":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512"},"issue":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512"},"comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512/comments"},"review_comments":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512/comments"},"review_comment":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512/commits"},"statuses":{"href":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/statuses/f3bd3ee3f23a7100131f8754308232f09c6eaa9e"}}}}