{"action":"created","comment":{"url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/comments/26316364","id":26316364,"diff_hunk":"@@ -21,14 +34,61 @@\n   @InjectView(R.id.home_action_card_make_request)\n   ActionCardView makeRequestCard;\n \n+  @InjectView(R.id.home_content_container)\n+  View contentContainer;\n+\n+  @InjectView(R.id.home_spinner_container)\n+  View spinnerContainer;\n+\n   @Override\n   protected void onCreate(Bundle savedInstanceState) {\n     super.onCreate(savedInstanceState);\n-    if (!SharedUserConnector.getInstance().isUserSignedIn()) {\n+    init();\n+  }\n+\n+  @Override\n+  protected void onStart() {\n+    super.onStart();\n+    if (CurrentUser.getInstance().state == CurrentUser.State.LOGGED_OUT) {\n       navigateToOnboarding();\n     } else {\n-      // TODO: check user state and go to the correct screen directly.\n-      init();\n+      showSpinner();\n+\n+      new GetCurrentState(CurrentUser.getToken()).executeAsync().continueWith(new Continuation<CurrentStateApiResult, Void>() {\n+        @Override\n+        public Void then(Task<CurrentStateApiResult> task) throws Exception {\n+          if (!task.isFaulted() && !task.isCancelled()) {\n+            switch (task.getResult().userState) {\n+              case LOGGED_OUT: {\n+                Log.e(\"HomeActivity\", \"Server should not report user as logged out\");\n+                finish();\n+              } break;\n+              case IDLE: {\n+                // TODO: a user might still have a declined request that he never saw. redirect to the declined request here.\n+                showContent();\n+              } break;\n+              case TRIPPING: {\n+                CurrentUser.getInstance().state = CurrentUser.State.TRIPPING;\n+                Intent intent = new Intent(HomeActivity.this, ManageTripActivity.class);\n+                ArrayList<IncomingRequest> list = new ArrayList<>(task.getResult().activeTripRequests.size());\n+                list.addAll(task.getResult().activeTripRequests);\n+                intent.putParcelableArrayListExtra(ManageTripActivity.EXTRA_REQUESTS, list);\n+                startActivity(intent);\n+              } break;\n+              case REQUESTING: {\n+                CurrentUser.getInstance().state = CurrentUser.State.REQUESTING;","path":"app/src/main/java/com/iic/shopingo/ui/HomeActivity.java","position":79,"original_position":79,"commit_id":"6e7bc0ce3201df6c7d0976cb88906f43fd275791","original_commit_id":"6e7bc0ce3201df6c7d0976cb88906f43fd275791","user":{"login":"ifeins","id":1324361,"avatar_url":"https://avatars.githubusercontent.com/u/1324361?v=3","gravatar_id":"","url":"https://api.github.com/users/ifeins","html_url":"https://github.com/ifeins","followers_url":"https://api.github.com/users/ifeins/followers","following_url":"https://api.github.com/users/ifeins/following{/other_user}","gists_url":"https://api.github.com/users/ifeins/gists{/gist_id}","starred_url":"https://api.github.com/users/ifeins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifeins/subscriptions","organizations_url":"https://api.github.com/users/ifeins/orgs","repos_url":"https://api.github.com/users/ifeins/repos","events_url":"https://api.github.com/users/ifeins/events{/privacy}","received_events_url":"https://api.github.com/users/ifeins/received_events","type":"User","site_admin":false},"body":"update server?","created_at":"2015-03-12T16:10:24Z","updated_at":"2015-03-12T16:10:24Z","html_url":"https://github.com/iic-ninjas/shopingo/pull/16#discussion_r26316364","pull_request_url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/comments/26316364"},"html":{"href":"https://github.com/iic-ninjas/shopingo/pull/16#discussion_r26316364"},"pull_request":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16","id":31034967,"html_url":"https://github.com/iic-ninjas/shopingo/pull/16","diff_url":"https://github.com/iic-ninjas/shopingo/pull/16.diff","patch_url":"https://github.com/iic-ninjas/shopingo/pull/16.patch","issue_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues/16","number":16,"state":"open","locked":false,"title":"Client side api","user":{"login":"AsafGartner","id":463270,"avatar_url":"https://avatars.githubusercontent.com/u/463270?v=3","gravatar_id":"","url":"https://api.github.com/users/AsafGartner","html_url":"https://github.com/AsafGartner","followers_url":"https://api.github.com/users/AsafGartner/followers","following_url":"https://api.github.com/users/AsafGartner/following{/other_user}","gists_url":"https://api.github.com/users/AsafGartner/gists{/gist_id}","starred_url":"https://api.github.com/users/AsafGartner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AsafGartner/subscriptions","organizations_url":"https://api.github.com/users/AsafGartner/orgs","repos_url":"https://api.github.com/users/AsafGartner/repos","events_url":"https://api.github.com/users/AsafGartner/events{/privacy}","received_events_url":"https://api.github.com/users/AsafGartner/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-12T13:26:31Z","updated_at":"2015-03-12T16:10:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64f8f3627c9619f05352d627dbc1d8af5d5b3619","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16/commits","review_comments_url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16/comments","review_comment_url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues/16/comments","statuses_url":"https://api.github.com/repos/iic-ninjas/shopingo/statuses/6e7bc0ce3201df6c7d0976cb88906f43fd275791","head":{"label":"iic-ninjas:client_side_api","ref":"client_side_api","sha":"6e7bc0ce3201df6c7d0976cb88906f43fd275791","user":{"login":"iic-ninjas","id":5079491,"avatar_url":"https://avatars.githubusercontent.com/u/5079491?v=3","gravatar_id":"","url":"https://api.github.com/users/iic-ninjas","html_url":"https://github.com/iic-ninjas","followers_url":"https://api.github.com/users/iic-ninjas/followers","following_url":"https://api.github.com/users/iic-ninjas/following{/other_user}","gists_url":"https://api.github.com/users/iic-ninjas/gists{/gist_id}","starred_url":"https://api.github.com/users/iic-ninjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iic-ninjas/subscriptions","organizations_url":"https://api.github.com/users/iic-ninjas/orgs","repos_url":"https://api.github.com/users/iic-ninjas/repos","events_url":"https://api.github.com/users/iic-ninjas/events{/privacy}","received_events_url":"https://api.github.com/users/iic-ninjas/received_events","type":"Organization","site_admin":false},"repo":{"id":31590540,"name":"shopingo","full_name":"iic-ninjas/shopingo","owner":{"login":"iic-ninjas","id":5079491,"avatar_url":"https://avatars.githubusercontent.com/u/5079491?v=3","gravatar_id":"","url":"https://api.github.com/users/iic-ninjas","html_url":"https://github.com/iic-ninjas","followers_url":"https://api.github.com/users/iic-ninjas/followers","following_url":"https://api.github.com/users/iic-ninjas/following{/other_user}","gists_url":"https://api.github.com/users/iic-ninjas/gists{/gist_id}","starred_url":"https://api.github.com/users/iic-ninjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iic-ninjas/subscriptions","organizations_url":"https://api.github.com/users/iic-ninjas/orgs","repos_url":"https://api.github.com/users/iic-ninjas/repos","events_url":"https://api.github.com/users/iic-ninjas/events{/privacy}","received_events_url":"https://api.github.com/users/iic-ninjas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iic-ninjas/shopingo","description":"","fork":false,"url":"https://api.github.com/repos/iic-ninjas/shopingo","forks_url":"https://api.github.com/repos/iic-ninjas/shopingo/forks","keys_url":"https://api.github.com/repos/iic-ninjas/shopingo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iic-ninjas/shopingo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iic-ninjas/shopingo/teams","hooks_url":"https://api.github.com/repos/iic-ninjas/shopingo/hooks","issue_events_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues/events{/number}","events_url":"https://api.github.com/repos/iic-ninjas/shopingo/events","assignees_url":"https://api.github.com/repos/iic-ninjas/shopingo/assignees{/user}","branches_url":"https://api.github.com/repos/iic-ninjas/shopingo/branches{/branch}","tags_url":"https://api.github.com/repos/iic-ninjas/shopingo/tags","blobs_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/refs{/sha}","trees_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iic-ninjas/shopingo/statuses/{sha}","languages_url":"https://api.github.com/repos/iic-ninjas/shopingo/languages","stargazers_url":"https://api.github.com/repos/iic-ninjas/shopingo/stargazers","contributors_url":"https://api.github.com/repos/iic-ninjas/shopingo/contributors","subscribers_url":"https://api.github.com/repos/iic-ninjas/shopingo/subscribers","subscription_url":"https://api.github.com/repos/iic-ninjas/shopingo/subscription","commits_url":"https://api.github.com/repos/iic-ninjas/shopingo/commits{/sha}","git_commits_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/commits{/sha}","comments_url":"https://api.github.com/repos/iic-ninjas/shopingo/comments{/number}","issue_comment_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues/comments{/number}","contents_url":"https://api.github.com/repos/iic-ninjas/shopingo/contents/{+path}","compare_url":"https://api.github.com/repos/iic-ninjas/shopingo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iic-ninjas/shopingo/merges","archive_url":"https://api.github.com/repos/iic-ninjas/shopingo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iic-ninjas/shopingo/downloads","issues_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues{/number}","pulls_url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls{/number}","milestones_url":"https://api.github.com/repos/iic-ninjas/shopingo/milestones{/number}","notifications_url":"https://api.github.com/repos/iic-ninjas/shopingo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iic-ninjas/shopingo/labels{/name}","releases_url":"https://api.github.com/repos/iic-ninjas/shopingo/releases{/id}","created_at":"2015-03-03T09:37:11Z","updated_at":"2015-03-12T14:31:36Z","pushed_at":"2015-03-12T14:31:37Z","git_url":"git://github.com/iic-ninjas/shopingo.git","ssh_url":"git@github.com:iic-ninjas/shopingo.git","clone_url":"https://github.com/iic-ninjas/shopingo.git","svn_url":"https://github.com/iic-ninjas/shopingo","homepage":null,"size":1124,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"iic-ninjas:master","ref":"master","sha":"6ad50981bae93731cca78a590ee07c8442bd3000","user":{"login":"iic-ninjas","id":5079491,"avatar_url":"https://avatars.githubusercontent.com/u/5079491?v=3","gravatar_id":"","url":"https://api.github.com/users/iic-ninjas","html_url":"https://github.com/iic-ninjas","followers_url":"https://api.github.com/users/iic-ninjas/followers","following_url":"https://api.github.com/users/iic-ninjas/following{/other_user}","gists_url":"https://api.github.com/users/iic-ninjas/gists{/gist_id}","starred_url":"https://api.github.com/users/iic-ninjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iic-ninjas/subscriptions","organizations_url":"https://api.github.com/users/iic-ninjas/orgs","repos_url":"https://api.github.com/users/iic-ninjas/repos","events_url":"https://api.github.com/users/iic-ninjas/events{/privacy}","received_events_url":"https://api.github.com/users/iic-ninjas/received_events","type":"Organization","site_admin":false},"repo":{"id":31590540,"name":"shopingo","full_name":"iic-ninjas/shopingo","owner":{"login":"iic-ninjas","id":5079491,"avatar_url":"https://avatars.githubusercontent.com/u/5079491?v=3","gravatar_id":"","url":"https://api.github.com/users/iic-ninjas","html_url":"https://github.com/iic-ninjas","followers_url":"https://api.github.com/users/iic-ninjas/followers","following_url":"https://api.github.com/users/iic-ninjas/following{/other_user}","gists_url":"https://api.github.com/users/iic-ninjas/gists{/gist_id}","starred_url":"https://api.github.com/users/iic-ninjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iic-ninjas/subscriptions","organizations_url":"https://api.github.com/users/iic-ninjas/orgs","repos_url":"https://api.github.com/users/iic-ninjas/repos","events_url":"https://api.github.com/users/iic-ninjas/events{/privacy}","received_events_url":"https://api.github.com/users/iic-ninjas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iic-ninjas/shopingo","description":"","fork":false,"url":"https://api.github.com/repos/iic-ninjas/shopingo","forks_url":"https://api.github.com/repos/iic-ninjas/shopingo/forks","keys_url":"https://api.github.com/repos/iic-ninjas/shopingo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iic-ninjas/shopingo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iic-ninjas/shopingo/teams","hooks_url":"https://api.github.com/repos/iic-ninjas/shopingo/hooks","issue_events_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues/events{/number}","events_url":"https://api.github.com/repos/iic-ninjas/shopingo/events","assignees_url":"https://api.github.com/repos/iic-ninjas/shopingo/assignees{/user}","branches_url":"https://api.github.com/repos/iic-ninjas/shopingo/branches{/branch}","tags_url":"https://api.github.com/repos/iic-ninjas/shopingo/tags","blobs_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/refs{/sha}","trees_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iic-ninjas/shopingo/statuses/{sha}","languages_url":"https://api.github.com/repos/iic-ninjas/shopingo/languages","stargazers_url":"https://api.github.com/repos/iic-ninjas/shopingo/stargazers","contributors_url":"https://api.github.com/repos/iic-ninjas/shopingo/contributors","subscribers_url":"https://api.github.com/repos/iic-ninjas/shopingo/subscribers","subscription_url":"https://api.github.com/repos/iic-ninjas/shopingo/subscription","commits_url":"https://api.github.com/repos/iic-ninjas/shopingo/commits{/sha}","git_commits_url":"https://api.github.com/repos/iic-ninjas/shopingo/git/commits{/sha}","comments_url":"https://api.github.com/repos/iic-ninjas/shopingo/comments{/number}","issue_comment_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues/comments{/number}","contents_url":"https://api.github.com/repos/iic-ninjas/shopingo/contents/{+path}","compare_url":"https://api.github.com/repos/iic-ninjas/shopingo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iic-ninjas/shopingo/merges","archive_url":"https://api.github.com/repos/iic-ninjas/shopingo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iic-ninjas/shopingo/downloads","issues_url":"https://api.github.com/repos/iic-ninjas/shopingo/issues{/number}","pulls_url":"https://api.github.com/repos/iic-ninjas/shopingo/pulls{/number}","milestones_url":"https://api.github.com/repos/iic-ninjas/shopingo/milestones{/number}","notifications_url":"https://api.github.com/repos/iic-ninjas/shopingo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iic-ninjas/shopingo/labels{/name}","releases_url":"https://api.github.com/repos/iic-ninjas/shopingo/releases{/id}","created_at":"2015-03-03T09:37:11Z","updated_at":"2015-03-12T14:31:36Z","pushed_at":"2015-03-12T14:31:37Z","git_url":"git://github.com/iic-ninjas/shopingo.git","ssh_url":"git@github.com:iic-ninjas/shopingo.git","clone_url":"https://github.com/iic-ninjas/shopingo.git","svn_url":"https://github.com/iic-ninjas/shopingo","homepage":null,"size":1124,"stargazers_count":0,"watchers_count":0,"language":"Java","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/iic-ninjas/shopingo/pulls/16"},"html":{"href":"https://github.com/iic-ninjas/shopingo/pull/16"},"issue":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/issues/16"},"comments":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/iic-ninjas/shopingo/statuses/6e7bc0ce3201df6c7d0976cb88906f43fd275791"}}}}