From 37bcac2575a6080406ece6149727eff49af059a4 Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Tue, 10 Jul 2012 17:17:04 -0700 Subject: [PATCH] Hopefully resolved a crash when cancelling google login --- .../com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java | 2 +- .../com/todoroo/astrid/actfm/ActFmLoginActivity.java | 4 +++- .../com/todoroo/astrid/actfm/sync/ActFmSyncService.java | 1 + .../com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java index fd5e61571..5b973603c 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmGoogleAuthActivity.java @@ -92,7 +92,7 @@ public class ActFmGoogleAuthActivity extends ListActivity { findViewById(R.id.empty_button).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - finish(); + onAuthCancel(); } }); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java index 8eef9eeec..0d25860ec 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/ActFmLoginActivity.java @@ -596,7 +596,9 @@ public class ActFmLoginActivity extends FragmentActivity implements AuthListener } errors.setVisibility(View.GONE); } else if (requestCode == REQUEST_CODE_GOOGLE) { - String email= data.getStringExtra(ActFmGoogleAuthActivity.RESULT_EMAIL); + if (data == null) + return; + String email = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_EMAIL); String token = data.getStringExtra(ActFmGoogleAuthActivity.RESULT_TOKEN); authenticate(email, email, "", "google", token); } diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java index 7fc648c32..6846a9537 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -1151,6 +1151,7 @@ public final class ActFmSyncService { if (remote.getValue(Task.USER_ID) != Task.USER_ID_SELF) remote.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true); + // TODO: It seems like something about this title matching might be causing SQLiteConstraint exceptions. Think about it. if (!remote.isSaved() && gtasksPreferenceService.isLoggedIn()) { titleMatchOnGoogleTask(remote); } 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 815912e41..ce7c08bb2 100644 --- a/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java +++ b/astrid/plugin-src/com/todoroo/astrid/gtasks/auth/GtasksLoginActivity.java @@ -110,7 +110,7 @@ public class GtasksLoginActivity extends ListActivity { findViewById(R.id.empty_button).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - finish(); + onAuthCancel(); } }); }