Show UI on retrieveRtToken() error

This commit is contained in:
Hattshire 2018-02-01 02:38:02 -03:00 committed by Marvin W
parent 908c20ccc2
commit f1cdb48a28
1 changed files with 11 additions and 4 deletions

View File

@ -144,6 +144,9 @@ public class LoginActivity extends AssistantActivity {
state++;
if (state == 1) {
init();
} else if (state == -1) {
setResult(RESULT_CANCELED);
finish();
}
}
@ -305,11 +308,15 @@ public class LoginActivity extends AssistantActivity {
retrieveGmsToken(account);
setResult(RESULT_OK);
} else {
showError(R.string.auth_general_error_desc);
Log.w(TAG, "Account NOT created!");
setResult(RESULT_CANCELED);
// TODO: Give the user a chance to read the message :)
finish();
runOnUiThread(new Runnable() {
@Override
public void run() {
showError(R.string.auth_general_error_desc);
setNextButtonText(android.R.string.ok);
}
});
state = -2;
}
}