Skip to content

Commit a0de23c

Browse files
committed
Small code clean up.
1 parent d0f1f8b commit a0de23c

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/main/java/com/dropbox/core/android/AuthActivity.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,13 @@ static Intent getOfficialAuthIntent() {
399399
return authIntent;
400400
}
401401

402-
402+
/**
403+
* AuthActivity is launched first time, or user didn't finish oauth/dauth flow but
404+
* switched back to this activity. (hit back button)
405+
*
406+
* If DAuth/Browser Auth succeeded, this flow should finish through onNewIntent()
407+
* instead of onResume().
408+
*/
403409
@Override
404410
protected void onResume() {
405411
super.onResume();
@@ -408,9 +414,12 @@ protected void onResume() {
408414
return;
409415
}
410416

411-
if (mAuthStateNonce != null || mAppKey == null) {
417+
boolean authNotFinish = mAuthStateNonce != null || mAppKey == null;
418+
419+
if (authNotFinish) {
412420
// We somehow returned to this activity without being forwarded
413421
// here by the official app.
422+
414423
// Most commonly caused by user hitting "back" from the auth screen
415424
// or (if doing browser auth) task switching from auth task back to
416425
// this one.
@@ -434,12 +443,12 @@ protected void onResume() {
434443
final Intent officialAuthIntent = getOfficialAuthIntent();
435444
officialAuthIntent.putExtra(EXTRA_CONSUMER_KEY, mAppKey);
436445
officialAuthIntent.putExtra(EXTRA_CONSUMER_SIG, "");
437-
officialAuthIntent.putExtra(EXTRA_DESIRED_UID, mDesiredUid);
438-
officialAuthIntent.putExtra(EXTRA_ALREADY_AUTHED_UIDS, mAlreadyAuthedUids);
439-
officialAuthIntent.putExtra(EXTRA_SESSION_ID, mSessionId);
440446
officialAuthIntent.putExtra(EXTRA_CALLING_PACKAGE, getPackageName());
441447
officialAuthIntent.putExtra(EXTRA_CALLING_CLASS, getClass().getName());
442448
officialAuthIntent.putExtra(EXTRA_AUTH_STATE, state);
449+
officialAuthIntent.putExtra(EXTRA_DESIRED_UID, mDesiredUid);
450+
officialAuthIntent.putExtra(EXTRA_ALREADY_AUTHED_UIDS, mAlreadyAuthedUids);
451+
officialAuthIntent.putExtra(EXTRA_SESSION_ID, mSessionId);
443452

444453
/*
445454
* An Android bug exists where onResume may be called twice in rapid succession.

0 commit comments

Comments
 (0)