Skip to content

Commit

Permalink
Merge pull request nickbutcher#246 from lineargs/master
Browse files Browse the repository at this point in the history
Fix DribbbleLogin ProgressBar loading forever on Login cancel
  • Loading branch information
nickbutcher authored Jan 22, 2018
2 parents f37bad2 + ce58ba8 commit 9be3604
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/src/main/java/io/plaidapp/ui/DribbbleLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,19 @@ protected void onCreate(Bundle savedInstanceState) {
isLoginFailed = savedInstanceState.getBoolean(STATE_LOGIN_FAILED, false);
loginFailed.setVisibility(isLoginFailed ? View.VISIBLE : View.GONE);
}
}

@Override
protected void onResume() {
super.onResume();
checkAuthCallback(getIntent());
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
checkAuthCallback(intent);
// Update getIntent() to this new Intent
setIntent(intent);
}

public void doLogin(View view) {
Expand Down Expand Up @@ -175,6 +180,9 @@ private void checkAuthCallback(Intent intent) {
&& DribbblePrefs.LOGIN_CALLBACK.equals(intent.getData().getAuthority())) {
showLoading();
getAccessToken(intent.getData().getQueryParameter("code"));
} else {
// Prevent ProgressBar loading forever on Login cancel
showLogin();
}
}

Expand Down

0 comments on commit 9be3604

Please sign in to comment.