Fix for oauth error when you are not online

pull/14/head
Tim Su 13 years ago
parent 9597e91ecc
commit d0a9889490

@ -19,6 +19,7 @@
*/
package com.todoroo.astrid.actfm;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
@ -105,13 +106,15 @@ public class ActFmGoogleAuthActivity extends ListActivity {
authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
onAuthTokenSuccess();
}
} catch (Exception e) {
} catch (final Exception e) {
Log.e("actfm-google-auth", "Login Error", e); //$NON-NLS-1$ //$NON-NLS-2$
ActFmGoogleAuthActivity.this.runOnUiThread(new Runnable() {
runOnUiThread(new Runnable() {
@Override
public void run() {
int error = e instanceof IOException ? R.string.gtasks_GLA_errorIOAuth :
R.string.gtasks_GLA_errorAuth;
Toast.makeText(ActFmGoogleAuthActivity.this,
R.string.gtasks_GLA_errorAuth,
error,
Toast.LENGTH_LONG).show();
}
});

@ -19,6 +19,7 @@
*/
package com.todoroo.astrid.gtasks.auth;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
@ -30,6 +31,7 @@ import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
@ -118,12 +120,16 @@ public class GtasksLoginActivity extends ListActivity {
authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
onAuthTokenSuccess();
}
} catch (Exception e) {
e.printStackTrace();
GtasksLoginActivity.this.runOnUiThread(new Runnable() {
} catch (final Exception e) {
Log.e("gtasks-login", "Login Error", e); //$NON-NLS-1$ //$NON-NLS-2$
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(GtasksLoginActivity.this, R.string.gtasks_GLA_errorAuth, Toast.LENGTH_LONG).show();
int error = e instanceof IOException ? R.string.gtasks_GLA_errorIOAuth :
R.string.gtasks_GLA_errorAuth;
Toast.makeText(GtasksLoginActivity.this,
error,
Toast.LENGTH_LONG).show();
}
});
} finally {

@ -75,6 +75,9 @@
<!-- Error Message when we receive a HTTP 401 Unauthorized -->
<string name="gtasks_GLA_errorAuth">Error authenticating! Please check your username and password in your phone\'s account manager</string>
<!-- Error Message when we receive an IO Exception -->
<string name="gtasks_GLA_errorIOAuth">Sorry, we had trouble communicating with Google servers. Please try again later.</string>
<!-- Error Message when we receive a HTTP 401 Unauthorized multiple times -->
<string name="gtasks_GLA_errorAuth_captcha">You may have encountered a captcha.

Loading…
Cancel
Save