Fixed all the error popups that could happen when autosyncing with no connection

pull/14/head
Sam Bosley 13 years ago
parent 18faf19368
commit 884eecd24a

@ -347,6 +347,7 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
* whether to display a dialog * whether to display a dialog
*/ */
protected void handleException(String tag, Exception e, boolean displayError) { protected void handleException(String tag, Exception e, boolean displayError) {
//TODO: When Crittercism supports it, report error to them
final Context context = ContextManager.getContext(); final Context context = ContextManager.getContext();
getUtilities().setLastError(e.toString()); getUtilities().setLastError(e.toString());

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid" package="com.timsu.astrid"
android:versionName="3.8.4.4" android:versionName="3.8.5"
android:versionCode="199"> android:versionCode="200">
<!-- widgets, alarms, and services will break if Astrid is installed on SD card --> <!-- widgets, alarms, and services will break if Astrid is installed on SD card -->
<!-- android:installLocation="internalOnly"> --> <!-- android:installLocation="internalOnly"> -->

@ -93,7 +93,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
// occurs when application was closed // occurs when application was closed
} catch (Exception e) { } catch (Exception e) {
handleException("actfm-authenticate", e, true); handleException("actfm-authenticate", e, false);
} finally { } finally {
actFmPreferenceService.stopOngoing(); actFmPreferenceService.stopOngoing();
} }
@ -152,7 +152,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
// occurs when application was closed // occurs when application was closed
} catch (Exception e) { } catch (Exception e) {
handleException("actfm-sync", e, true); //$NON-NLS-1$ handleException("actfm-sync", e, false); //$NON-NLS-1$
} finally { } finally {
StatisticsService.reportEvent(StatisticsConstants.ACTFM_SYNC_FINISHED, StatisticsService.reportEvent(StatisticsConstants.ACTFM_SYNC_FINISHED,
"success", Boolean.toString(syncSuccess)); //$NON-NLS-1$ "success", Boolean.toString(syncSuccess)); //$NON-NLS-1$

@ -453,21 +453,23 @@ public class FilterListActivity extends ExpandableListActivity {
@Override @Override
public void run() { public void run() {
try { try {
Preferences.setLong(LAST_TAG_REFRESH_KEY, DateUtilities.now());
actFmSyncService.fetchTags(0); actFmSyncService.fetchTags(0);
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
Preferences.setLong(LAST_TAG_REFRESH_KEY, DateUtilities.now());
adapter.clear(); adapter.clear();
adapter.getLists(); adapter.getLists();
} }
}); });
} catch (IOException e) { } catch (IOException e) {
exceptionService.displayAndReportError(FilterListActivity.this, "refresh-tags-io", e); if (manual)
exceptionService.displayAndReportError(FilterListActivity.this, "refresh-tags-io", e);
} catch (JSONException e) { } catch (JSONException e) {
exceptionService.displayAndReportError(FilterListActivity.this, "refresh-tags-json", e); if (manual)
exceptionService.displayAndReportError(FilterListActivity.this, "refresh-tags-json", e);
} finally { } finally {
if (manual) if (manual)
DialogUtilities.dismissDialog(FilterListActivity.this, progressDialog); DialogUtilities.dismissDialog(FilterListActivity.this, progressDialog);

@ -156,6 +156,8 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
/** token for indicating source of TLA launch */ /** token for indicating source of TLA launch */
public static final String TOKEN_SOURCE = "source"; //$NON-NLS-1$ public static final String TOKEN_SOURCE = "source"; //$NON-NLS-1$
private static final String LAST_AUTOSYNC_ATTEMPT = "last-autosync"; //$NON-NLS-1$
// --- instance variables // --- instance variables
@Autowired ExceptionService exceptionService; @Autowired ExceptionService exceptionService;
@ -473,11 +475,15 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
private void initiateAutomaticSync() { private void initiateAutomaticSync() {
if (!actFmPreferenceService.isLoggedIn()) return; if (!actFmPreferenceService.isLoggedIn()) return;
long lastFetchDate = actFmPreferenceService.getLastSyncDate(); long lastFetchDate = actFmPreferenceService.getLastSyncDate();
if(DateUtilities.now() < lastFetchDate + 300000L) long lastAutosyncAttempt = Preferences.getLong(LAST_AUTOSYNC_ATTEMPT, 0);
long lastTry = Math.max(lastFetchDate, lastAutosyncAttempt);
if(DateUtilities.now() < lastTry + 300000L)
return; return;
new Thread() { new Thread() {
@Override @Override
public void run() { public void run() {
Preferences.setLong(LAST_AUTOSYNC_ATTEMPT, DateUtilities.now());
new ActFmSyncProvider().synchronize(TaskListActivity.this); new ActFmSyncProvider().synchronize(TaskListActivity.this);
} }
}.start(); }.start();

@ -40,6 +40,8 @@ import com.todoroo.astrid.utility.AstridPreferences;
public final class UpgradeService { public final class UpgradeService {
public static final int V3_8_5 = 200;
public static final int V3_8_4_4 = 199;
public static final int V3_8_4_3 = 198; public static final int V3_8_4_3 = 198;
public static final int V3_8_4_2 = 197; public static final int V3_8_4_2 = 197;
public static final int V3_8_4_1 = 196; public static final int V3_8_4_1 = 196;
@ -158,6 +160,16 @@ public final class UpgradeService {
StringBuilder changeLog = new StringBuilder(); StringBuilder changeLog = new StringBuilder();
// current message // current message
if (from < V3_8_5) {
newVersionString(changeLog, "3.8.5 (10/27/11)", new String[] {
"All new reminders and nudges!",
"Share lists and tasks with iPhone users!",
"Better sync with Chrome App and Astrid.com",
"Numerous bugs destroyed",
"Have a spectacular day!",
});
}
if (from >= V3_8_4 && from < V3_8_4_3) { if (from >= V3_8_4 && from < V3_8_4_3) {
newVersionString(changeLog, "3.8.4.3 (10/05/11)", new String[] { newVersionString(changeLog, "3.8.4.3 (10/05/11)", new String[] {
"Additional fixes to Google Tasks API, and added better error messages to " + "Additional fixes to Google Tasks API, and added better error messages to " +

Loading…
Cancel
Save