Possible workaround for samsung account manager bug

pull/14/head
Sam Bosley 13 years ago
parent 6c47306e9a
commit 6ee85f7003

@ -2,7 +2,6 @@ package com.todoroo.astrid.gtasks.api;
import java.io.IOException; import java.io.IOException;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import com.google.api.client.extensions.android2.AndroidHttp; import com.google.api.client.extensions.android2.AndroidHttp;
@ -21,7 +20,6 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager; import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService; import com.todoroo.andlib.service.ExceptionService;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.astrid.gtasks.auth.GtasksTokenValidator; import com.todoroo.astrid.gtasks.auth.GtasksTokenValidator;
/** /**
@ -71,11 +69,6 @@ public class GtasksService {
final Context context = ContextManager.getContext(); final Context context = ContextManager.getContext();
String message = context.getString(R.string.gtasks_error_backend); String message = context.getString(R.string.gtasks_error_backend);
exceptionService.reportError(message, h); exceptionService.reportError(message, h);
if(context instanceof Activity) {
DialogUtilities.okDialog((Activity)context,
message, null);
}
throw h; throw h;
} }
} }

@ -20,6 +20,7 @@
package com.todoroo.astrid.gtasks.auth; package com.todoroo.astrid.gtasks.auth;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Locale;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import android.accounts.Account; import android.accounts.Account;
@ -112,10 +113,7 @@ public class GtasksLoginActivity extends ListActivity {
public void run() { public void run() {
try { try {
Bundle bundle = future.getResult(30, TimeUnit.SECONDS); Bundle bundle = future.getResult(30, TimeUnit.SECONDS);
if (bundle.containsKey(AccountManager.KEY_INTENT)) { if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
Intent i = (Intent) bundle.get(AccountManager.KEY_INTENT);
startActivityForResult(i, REQUEST_AUTHENTICATE);
} else if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) {
authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN); authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN);
onAuthTokenSuccess(); onAuthTokenSuccess();
} }
@ -134,7 +132,7 @@ public class GtasksLoginActivity extends ListActivity {
}.start(); }.start();
} }
}; };
accountManager.manager.getAuthToken(a, GtasksService.AUTH_TOKEN_TYPE, true, callback, null); accountManager.manager.getAuthToken(a, GtasksService.AUTH_TOKEN_TYPE, null, this, callback, null);
} }
private void onAuthCancel() { private void onAuthCancel() {

@ -37,7 +37,7 @@ public class GtasksTokenValidator {
} }
accountManager.invalidateAuthToken(token); accountManager.invalidateAuthToken(token);
AccountManagerFuture<Bundle> future = accountManager.manager.getAuthToken(a, GtasksService.AUTH_TOKEN_TYPE, true, null, null); AccountManagerFuture<Bundle> future = accountManager.manager.getAuthToken(a, GtasksService.AUTH_TOKEN_TYPE, false, null, null);
try { try {
if (future.getResult().containsKey(AccountManager.KEY_AUTHTOKEN)) { if (future.getResult().containsKey(AccountManager.KEY_AUTHTOKEN)) {

Loading…
Cancel
Save