{"action":"created","issue":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512","labels_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512/labels{/name}","comments_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512/comments","events_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512/events","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512","id":67505983,"number":3512,"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},"labels":[{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/labels/review","name":"review","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-04-10T04:22:52Z","updated_at":"2015-04-15T23:02:09Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/pulls/3512","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"},"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 ."},"comment":{"url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/comments/93592528","html_url":"https://github.com/wordpress-mobile/WordPress-iOS/pull/3512#issuecomment-93592528","issue_url":"https://api.github.com/repos/wordpress-mobile/WordPress-iOS/issues/3512","id":93592528,"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},"created_at":"2015-04-15T23:02:09Z","updated_at":"2015-04-15T23:02:09Z","body":"Sounds good - I'll create a few issues to clean up the Facades and then merge this in. Thanks guys!"}}