From e30263b04ecb946f06300bdaa2c18f3d53bb9607 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 19 Jan 2012 13:03:44 -0800 Subject: [PATCH 1/9] Modified proguard to keep a class that gtasks sync needs --- astrid/proguard.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/astrid/proguard.cfg b/astrid/proguard.cfg index 865e2c62a..305d15bc8 100644 --- a/astrid/proguard.cfg +++ b/astrid/proguard.cfg @@ -11,6 +11,7 @@ -keep, allowshrinking, allowoptimization class com.todoroo.** -keep class com.mdimension.** -keep class com.google.common.base.Preconditions +-keep class com.google.gson.stream.JsonReader -keep class * extends com.todoroo.andlib.data.AbstractModel # ignore reflection-based access from google libraries From dd7daff53945f2b928b63701e15005ffbadfbc7e Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Thu, 19 Jan 2012 13:10:57 -0800 Subject: [PATCH 2/9] Version bump and upgrade message --- astrid/AndroidManifest.xml | 4 ++-- .../src/com/todoroo/astrid/service/UpgradeService.java | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml index 3fdc76eff..f2d95df3e 100644 --- a/astrid/AndroidManifest.xml +++ b/astrid/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionName="3.9.2.3" + android:versionCode="210"> diff --git a/astrid/src/com/todoroo/astrid/service/UpgradeService.java b/astrid/src/com/todoroo/astrid/service/UpgradeService.java index 8f30baa9f..457c22a42 100644 --- a/astrid/src/com/todoroo/astrid/service/UpgradeService.java +++ b/astrid/src/com/todoroo/astrid/service/UpgradeService.java @@ -40,6 +40,7 @@ import com.todoroo.astrid.utility.AstridPreferences; public final class UpgradeService { + public static final int V3_9_2_3 = 210; public static final int V3_9_2_2 = 209; public static final int V3_9_2_1 = 208; public static final int V3_9_2 = 207; @@ -173,6 +174,14 @@ public final class UpgradeService { Preferences.clear(AstridPreferences.P_UPGRADE_FROM); StringBuilder changeLog = new StringBuilder(); + if (from >= V3_9_2 && from < V3_9_2_3) { + newVersionString(changeLog, "3.9.2.3 (1/20/12)", new String[] { + "Fixed a bug with displaying update messages", + "Fixed an occasional crash in Gtasks Sync", + "Other minor bugfixes" + }); + } + if (from >= V3_9_2 && from < V3_9_2_2) { newVersionString(changeLog, "3.9.2.2 (1/19/12)", new String[] { "Astrid now recognizes words like 'tomorrow', 'monday', '!!!' and '2 pm' to set date and importance", From 6ebe7a3461048ab0903c96d5cc41791ec3b61eeb Mon Sep 17 00:00:00 2001 From: Andrew Shaw Date: Thu, 19 Jan 2012 20:27:08 -0800 Subject: [PATCH 3/9] Walkthrough text polish with henry --- astrid/res/values/strings-welcome.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/astrid/res/values/strings-welcome.xml b/astrid/res/values/strings-welcome.xml index 38c36c9eb..44d83370a 100644 --- a/astrid/res/values/strings-welcome.xml +++ b/astrid/res/values/strings-welcome.xml @@ -15,9 +15,9 @@ That\'s it! - The perfect personal\nto-do list that works great\nwith friends - Perfect for any list:\nto read, to watch, to buy,\nto visit, to do! - Share lists\nwith friends, housemates,\nor your sweetheart! + The perfect to-do list that \nworks great with friends + Perfect for any list:\nread, watch, buy, visit! + Share lists with \nfriends, housemates,\nor your sweetheart! Never wonder who\'s\nbringing dessert! Tap to add notes,\nset reminders,\nand much more! Additional features,\nproductivity tips, and\nsuggestions from friends From 7094a852cc0e1de5386943bc489ab603e1d2baf8 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 20 Jan 2012 13:24:46 -0800 Subject: [PATCH 4/9] Fix proguard optimizing out a google method, round 2 --- astrid/proguard.cfg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/astrid/proguard.cfg b/astrid/proguard.cfg index 305d15bc8..e5192ca45 100644 --- a/astrid/proguard.cfg +++ b/astrid/proguard.cfg @@ -11,8 +11,10 @@ -keep, allowshrinking, allowoptimization class com.todoroo.** -keep class com.mdimension.** -keep class com.google.common.base.Preconditions --keep class com.google.gson.stream.JsonReader -keep class * extends com.todoroo.andlib.data.AbstractModel +-keep class com.google.gson.stream.JsonReader { + public void setLenient(boolean); +} # ignore reflection-based access from google libraries -dontwarn com.google.** From 363db8d62c18dd825cc7051fd920ec8ada5ad8c5 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Mon, 23 Jan 2012 17:45:46 -0800 Subject: [PATCH 5/9] One-click google login. --- astrid/AndroidManifest.xml | 2 + .../astrid/actfm/ActFmGoogleAuthActivity.java | 190 ++++++++++++++++++ .../astrid/actfm/ActFmLoginActivity.java | 44 ++-- .../gtasks/auth/GtasksLoginActivity.java | 3 +- astrid/res/layout/gtasks_login_activity.xml | 22 +- astrid/res/values/strings-actfm.xml | 7 +- 6 files changed, 223 insertions(+), 45 deletions(-) create mode 100644 astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java diff --git a/astrid/AndroidManifest.xml b/astrid/AndroidManifest.xml index f2d95df3e..3c1625e6f 100644 --- a/astrid/AndroidManifest.xml +++ b/astrid/AndroidManifest.xml @@ -321,6 +321,8 @@ + diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java new file mode 100644 index 000000000..a8c2b280d --- /dev/null +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java @@ -0,0 +1,190 @@ +/* + * ASTRID: Android's Simple Task Recording Dashboard + * + * Copyright (c) 2009 Tim Su + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package com.todoroo.astrid.actfm; + +import java.util.ArrayList; +import java.util.concurrent.TimeUnit; + +import android.accounts.Account; +import android.accounts.AccountManager; +import android.accounts.AccountManagerCallback; +import android.accounts.AccountManagerFuture; +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; +import android.widget.Toast; + +import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager; +import com.timsu.astrid.R; +import com.todoroo.andlib.service.Autowired; +import com.todoroo.andlib.service.ContextManager; +import com.todoroo.andlib.service.DependencyInjectionService; +import com.todoroo.andlib.utility.DialogUtilities; +import com.todoroo.astrid.actfm.sync.ActFmInvoker; +import com.todoroo.astrid.service.AstridDependencyInjector; +import com.todoroo.astrid.service.StatisticsService; + +/** + * This activity allows users to sign in or log in to Google Tasks + * through the Android account manager + * + * @author Sam Bosley + * + */ +public class ActFmGoogleAuthActivity extends ListActivity { + + private static final String AUTH_TOKEN_TYPE = "oauth2:https://www.astrid.com"; //$NON-NLS-1$ + + public static final String RESULT_EMAIL = "email"; //$NON-NLS-1$ + public static final String RESULT_TOKEN = "token"; //$NON-NLS-1$ + + @Autowired ActFmInvoker actFmInvoker; + + // --- ui initialization + + private GoogleAccountManager accountManager; + private String[] nameArray; + + private String authToken; + private String accountName; + + static { + AstridDependencyInjector.initialize(); + } + + public ActFmGoogleAuthActivity() { + super(); + DependencyInjectionService.getInstance().inject(this); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ContextManager.setContext(this); + + setContentView(R.layout.gtasks_login_activity); + setTitle(R.string.actfm_GAA_title); + + accountManager = new GoogleAccountManager(this); + Account[] accounts = accountManager.getAccounts(); + ArrayList accountNames = new ArrayList(); + for (Account a : accounts) { + accountNames.add(a.name); + } + + nameArray = accountNames.toArray(new String[accountNames.size()]); + setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, nameArray)); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + super.onListItemClick(l, v, position, id); + final ProgressDialog pd = DialogUtilities.progressDialog(this, this.getString(R.string.gtasks_GLA_authenticating)); + pd.show(); + final Account a = accountManager.getAccountByName(nameArray[position]); + accountName = a.name; + getAuthToken(a, pd); + } + + private void getAuthToken(Account a, final ProgressDialog pd) { + AccountManagerCallback callback = new AccountManagerCallback() { + public void run(final AccountManagerFuture future) { + new Thread() { + @Override + public void run() { + try { + Bundle bundle = future.getResult(30, TimeUnit.SECONDS); + if (bundle.containsKey(AccountManager.KEY_AUTHTOKEN)) { + authToken = bundle.getString(AccountManager.KEY_AUTHTOKEN); + onAuthTokenSuccess(); + } + } catch (Exception e) { + Log.e("actfm-google-auth", "Login Error", e); //$NON-NLS-1$ //$NON-NLS-2$ + ActFmGoogleAuthActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + Toast.makeText(ActFmGoogleAuthActivity.this, + R.string.gtasks_GLA_errorAuth, + Toast.LENGTH_LONG).show(); + } + }); + } finally { + DialogUtilities.dismissDialog(ActFmGoogleAuthActivity.this, pd); + } + } + }.start(); + } + }; + accountManager.manager.getAuthToken(a, AUTH_TOKEN_TYPE, null, this, callback, null); + } + + private void onAuthCancel() { + setResult(RESULT_CANCELED); + finish(); + } + + private void onAuthTokenSuccess() { + Intent data = new Intent(); + data.putExtra(RESULT_EMAIL, accountName); + data.putExtra(RESULT_TOKEN, authToken); + setResult(RESULT_OK, data); + finish(); + } + + + @Override + protected void onResume() { + super.onResume(); + StatisticsService.sessionStart(this); + } + + @Override + protected void onPause() { + super.onPause(); + StatisticsService.sessionPause(); + } + + @Override + protected void onStop() { + super.onStop(); + StatisticsService.sessionStop(this); + } + + private static final int REQUEST_AUTHENTICATE = 0; + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if(requestCode == REQUEST_AUTHENTICATE && resultCode == RESULT_OK){ + final ProgressDialog pd = DialogUtilities.progressDialog(this, this.getString(R.string.gtasks_GLA_authenticating)); + pd.show(); + final Account a = accountManager.getAccountByName(accountName); + getAuthToken(a, pd); + } else { + onAuthCancel(); + } + } + +} \ No newline at end of file diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java index f1cc30489..2f6632588 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java @@ -21,9 +21,7 @@ package com.todoroo.astrid.actfm; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; -import java.security.NoSuchAlgorithmException; import java.util.Random; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -79,9 +77,9 @@ import com.todoroo.astrid.service.StatisticsService; import com.todoroo.astrid.service.TaskService; /** - * This activity allows users to sign in or log in to Producteev + * This activity allows users to sign in or log in to Astrid.com * - * @author arne.jans + * @author Tim Su * */ public class ActFmLoginActivity extends Activity implements AuthListener { @@ -102,13 +100,14 @@ public class ActFmLoginActivity extends Activity implements AuthListener { private TextView errors; protected boolean noSync = false; - public static final String SHOW_TOAST = "show_toast"; + public static final String SHOW_TOAST = "show_toast"; //$NON-NLS-1$ + private boolean showToast; // --- ui initialization private static final int REQUEST_CODE_GOOGLE_ACCOUNTS = 1; - private static final int REQUEST_CODE_OAUTH = 2; + private static final int REQUEST_CODE_GOOGLE = 2; static { AstridDependencyInjector.initialize(); @@ -129,7 +128,6 @@ public class ActFmLoginActivity extends Activity implements AuthListener { DependencyInjectionService.getInstance().inject(this); } - @SuppressWarnings("nls") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -186,6 +184,7 @@ public class ActFmLoginActivity extends Activity implements AuthListener { StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_SHOW); } + @SuppressWarnings("nls") protected void initializeUI() { facebook = new Facebook(APP_ID); facebookRunner = new AsyncFacebookRunner(facebook); @@ -204,21 +203,11 @@ public class ActFmLoginActivity extends Activity implements AuthListener { protected final OnClickListener googleListener = new OnClickListener() { @Override - @SuppressWarnings("nls") public void onClick(View arg0) { Intent intent = new Intent(ActFmLoginActivity.this, - OAuthLoginActivity.class); - try { - String url = actFmInvoker.createFetchUrl("user_oauth", - "provider", "google"); - intent.putExtra(OAuthLoginActivity.URL_TOKEN, url); - startActivityForResult(intent, REQUEST_CODE_OAUTH); - StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_GL_START); - } catch (UnsupportedEncodingException e) { - handleError(e); - } catch (NoSuchAlgorithmException e) { - handleError(e); - } + ActFmGoogleAuthActivity.class); + startActivityForResult(intent, REQUEST_CODE_GOOGLE); + StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_GL_START); } }; @@ -538,15 +527,10 @@ public class ActFmLoginActivity extends Activity implements AuthListener { onFBAuthSucceed(); } errors.setVisibility(View.GONE); - } else if (requestCode == REQUEST_CODE_OAUTH) { - String result = data.getStringExtra(OAuthLoginActivity.DATA_RESPONSE); - try { - JSONObject json = new JSONObject(result); - postAuthenticate(json, json.getString("token")); - StatisticsService.reportEvent(StatisticsConstants.ACTFM_LOGIN_GL_SUCCESS); - } catch (JSONException e) { - handleError(e); - } + } else if (requestCode == REQUEST_CODE_GOOGLE) { + String email= data.getStringExtra(ActFmGoogleAuthActivity.RESULT_EMAIL); + String token = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_TOKEN); + authenticate(email, email, "google", token); } } @@ -565,4 +549,4 @@ public class ActFmLoginActivity extends Activity implements AuthListener { REQUEST_CODE_GOOGLE_ACCOUNTS, false); } -} \ No newline at end of file +} 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 814b340dd..393311e07 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java @@ -81,8 +81,9 @@ public class GtasksLoginActivity extends ListActivity { super.onCreate(savedInstanceState); ContextManager.setContext(this); + setContentView(R.layout.gtasks_login_activity); setTitle(R.string.gtasks_GLA_title); - getListView().setBackgroundColor(getResources().getColor(android.R.color.background_dark)); + accountManager = new GoogleAccountManager(this); Account[] accounts = accountManager.getAccounts(); ArrayList accountNames = new ArrayList(); diff --git a/astrid/res/layout/gtasks_login_activity.xml b/astrid/res/layout/gtasks_login_activity.xml index 7e1fd031f..c573b861e 100644 --- a/astrid/res/layout/gtasks_login_activity.xml +++ b/astrid/res/layout/gtasks_login_activity.xml @@ -1,14 +1,18 @@ - + + android:layout_width="fill_parent" + android:layout_height="fill_parent"/> + + android:layout_width="fill_parent" + android:layout_height="fill_parent" + android:text="@string/gtasks_GLA_noaccounts" + android:gravity="center" + style="@style/TextAppearance.TLA_NoItems" /> - \ No newline at end of file + \ No newline at end of file diff --git a/astrid/res/values/strings-actfm.xml b/astrid/res/values/strings-actfm.xml index c7082ab02..c7db8beb3 100644 --- a/astrid/res/values/strings-actfm.xml +++ b/astrid/res/values/strings-actfm.xml @@ -220,11 +220,8 @@ Login to Astrid.com - - Please connect to Google: - - - Astrid won\'t send messages e-mails without permission. + + Select a Google account: From 9597e91ecc9d9683d85ebe801f8e9819f77e5a67 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Mon, 23 Jan 2012 18:01:39 -0800 Subject: [PATCH 6/9] Use userinfo.profile as authentication scope to get user information --- .../astrid/actfm/ActFmGoogleAuthActivity.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java index a8c2b280d..586d5877b 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java @@ -38,12 +38,8 @@ import android.widget.Toast; import com.google.api.client.googleapis.extensions.android2.auth.GoogleAccountManager; import com.timsu.astrid.R; -import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.ContextManager; -import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.utility.DialogUtilities; -import com.todoroo.astrid.actfm.sync.ActFmInvoker; -import com.todoroo.astrid.service.AstridDependencyInjector; import com.todoroo.astrid.service.StatisticsService; /** @@ -55,13 +51,11 @@ import com.todoroo.astrid.service.StatisticsService; */ public class ActFmGoogleAuthActivity extends ListActivity { - private static final String AUTH_TOKEN_TYPE = "oauth2:https://www.astrid.com"; //$NON-NLS-1$ + private static final String AUTH_TOKEN_TYPE = "oauth2:https://www.googleapis.com/auth/userinfo.profile"; //$NON-NLS-1$ public static final String RESULT_EMAIL = "email"; //$NON-NLS-1$ public static final String RESULT_TOKEN = "token"; //$NON-NLS-1$ - @Autowired ActFmInvoker actFmInvoker; - // --- ui initialization private GoogleAccountManager accountManager; @@ -70,15 +64,6 @@ public class ActFmGoogleAuthActivity extends ListActivity { private String authToken; private String accountName; - static { - AstridDependencyInjector.initialize(); - } - - public ActFmGoogleAuthActivity() { - super(); - DependencyInjectionService.getInstance().inject(this); - } - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); From d0a988949051cf3ede4e599a606eb17de595b0de Mon Sep 17 00:00:00 2001 From: Tim Su Date: Mon, 23 Jan 2012 18:38:26 -0800 Subject: [PATCH 7/9] Fix for oauth error when you are not online --- .../astrid/actfm/ActFmGoogleAuthActivity.java | 9 ++++++--- .../astrid/gtasks/auth/GtasksLoginActivity.java | 14 ++++++++++---- astrid/res/values/strings-gtasks.xml | 3 +++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java index 586d5877b..59ec6765e 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java @@ -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(); } }); 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 393311e07..17ed289df 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java @@ -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 { diff --git a/astrid/res/values/strings-gtasks.xml b/astrid/res/values/strings-gtasks.xml index b764607fd..190c3a478 100644 --- a/astrid/res/values/strings-gtasks.xml +++ b/astrid/res/values/strings-gtasks.xml @@ -75,6 +75,9 @@ Error authenticating! Please check your username and password in your phone\'s account manager + + + Sorry, we had trouble communicating with Google servers. Please try again later. You may have encountered a captcha. From f80ebaa0c92203c2019885fb7aaa3a6832e018e9 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Tue, 24 Jan 2012 21:06:22 -0800 Subject: [PATCH 8/9] Fix for first_task and first_list metrics not being reported --- astrid/src/com/todoroo/astrid/dao/MetadataDao.java | 2 +- astrid/src/com/todoroo/astrid/dao/TaskDao.java | 4 ++-- astrid/src/com/todoroo/astrid/utility/AstridPreferences.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/dao/MetadataDao.java b/astrid/src/com/todoroo/astrid/dao/MetadataDao.java index bd0bd301c..778187966 100644 --- a/astrid/src/com/todoroo/astrid/dao/MetadataDao.java +++ b/astrid/src/com/todoroo/astrid/dao/MetadataDao.java @@ -73,7 +73,7 @@ public class MetadataDao extends DatabaseDao { item.setValue(Metadata.CREATION_DATE, DateUtilities.now()); boolean state = super.persist(item); - if(Preferences.getBoolean(AstridPreferences.P_FIRST_LIST, false)) { + if(Preferences.getBoolean(AstridPreferences.P_FIRST_LIST, true)) { if (state && item.getValue(Metadata.KEY).equals(TagService.KEY)) { StatisticsService.reportEvent(StatisticsConstants.USER_FIRST_LIST); Preferences.setBoolean(AstridPreferences.P_FIRST_LIST, false); diff --git a/astrid/src/com/todoroo/astrid/dao/TaskDao.java b/astrid/src/com/todoroo/astrid/dao/TaskDao.java index b6faa8b43..efe51afc3 100644 --- a/astrid/src/com/todoroo/astrid/dao/TaskDao.java +++ b/astrid/src/com/todoroo/astrid/dao/TaskDao.java @@ -207,9 +207,9 @@ public class TaskDao extends DatabaseDao { } private void userRetentionMetrics() { - if(Preferences.getBoolean(AstridPreferences.P_FIRST_ACTION, false)) { + if(Preferences.getBoolean(AstridPreferences.P_FIRST_TASK, true)) { StatisticsService.reportEvent(StatisticsConstants.USER_FIRST_TASK); - Preferences.setBoolean(AstridPreferences.P_FIRST_ACTION, false); + Preferences.setBoolean(AstridPreferences.P_FIRST_TASK, false); } long firstLaunchTime = Preferences.getLong(AstridPreferences.P_FIRST_LAUNCH, 0); diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java index d5f8c533b..b2631ae79 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -15,7 +15,7 @@ public class AstridPreferences { private static final String P_CURRENT_VERSION = "cv"; //$NON-NLS-1$ - public static final String P_FIRST_ACTION = "fa"; //$NON-NLS-1$ + public static final String P_FIRST_TASK = "ft"; //$NON-NLS-1$ public static final String P_FIRST_LIST = "fl"; //$NON-NLS-1$ From 15db4fbd867a5fceb02a9034631f3c7d6b2e2398 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Tue, 24 Jan 2012 21:08:38 -0800 Subject: [PATCH 9/9] More fix --- .../com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java index 3be21794c..3cb407732 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmPreferenceService.java @@ -41,7 +41,7 @@ public class ActFmPreferenceService extends SyncProviderUtilities { @Override public boolean shouldShowToast() { - if(Preferences.getBoolean(AstridPreferences.P_FIRST_ACTION, false)) + if(Preferences.getBoolean(AstridPreferences.P_FIRST_TASK, true)) return false; return super.shouldShowToast(); }