From 6ee85f7003f0bcbeb8cf425a31c5bc267a01c1c1 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 21 Sep 2011 12:38:37 -0700 Subject: [PATCH] Possible workaround for samsung account manager bug --- .../com/todoroo/astrid/gtasks/api/GtasksService.java | 7 ------- .../todoroo/astrid/gtasks/auth/GtasksLoginActivity.java | 8 +++----- .../todoroo/astrid/gtasks/auth/GtasksTokenValidator.java | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/api/GtasksService.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/api/GtasksService.java index 5b52a59f9..91baa3a65 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/api/GtasksService.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/api/GtasksService.java @@ -2,7 +2,6 @@ package com.todoroo.astrid.gtasks.api; import java.io.IOException; -import android.app.Activity; import android.content.Context; 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.DependencyInjectionService; import com.todoroo.andlib.service.ExceptionService; -import com.todoroo.andlib.utility.DialogUtilities; import com.todoroo.astrid.gtasks.auth.GtasksTokenValidator; /** @@ -71,11 +69,6 @@ public class GtasksService { final Context context = ContextManager.getContext(); String message = context.getString(R.string.gtasks_error_backend); exceptionService.reportError(message, h); - - if(context instanceof Activity) { - DialogUtilities.okDialog((Activity)context, - message, null); - } throw h; } } diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java index 2c74a13b1..65fa3b98d 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java @@ -20,6 +20,7 @@ package com.todoroo.astrid.gtasks.auth; import java.util.ArrayList; +import java.util.Locale; import java.util.concurrent.TimeUnit; import android.accounts.Account; @@ -112,10 +113,7 @@ public class GtasksLoginActivity extends ListActivity { public void run() { try { Bundle bundle = future.getResult(30, TimeUnit.SECONDS); - if (bundle.containsKey(AccountManager.KEY_INTENT)) { - Intent i = (Intent) bundle.get(AccountManager.KEY_INTENT); - startActivityForResult(i, REQUEST_AUTHENTICATE); - } else if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) { + if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) { authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN); onAuthTokenSuccess(); } @@ -134,7 +132,7 @@ public class GtasksLoginActivity extends ListActivity { }.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() { diff --git a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java index 8baf42acc..2a3c97585 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksTokenValidator.java @@ -37,7 +37,7 @@ public class GtasksTokenValidator { } accountManager.invalidateAuthToken(token); - AccountManagerFuture future = accountManager.manager.getAuthToken(a, GtasksService.AUTH_TOKEN_TYPE, true, null, null); + AccountManagerFuture future = accountManager.manager.getAuthToken(a, GtasksService.AUTH_TOKEN_TYPE, false, null, null); try { if (future.getResult().containsKey(AccountManager.KEY_AUTHTOKEN)) {