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
*/
protected void handleException(String tag, Exception e, boolean displayError) {
//TODO: When Crittercism supports it, report error to them
final Context context = ContextManager.getContext();
getUtilities().setLastError(e.toString());

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

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

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

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

@ -40,6 +40,8 @@ import com.todoroo.astrid.utility.AstridPreferences;
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_2 = 197;
public static final int V3_8_4_1 = 196;
@ -158,6 +160,16 @@ public final class UpgradeService {
StringBuilder changeLog = new StringBuilder();
// 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) {
newVersionString(changeLog, "3.8.4.3 (10/05/11)", new String[] {
"Additional fixes to Google Tasks API, and added better error messages to " +

Loading…
Cancel
Save