Three options for localytics data in sync success--failed, errors, or success

pull/14/head
Sam Bosley 14 years ago
parent 1f1d6050f8
commit f97f21ae17

@ -218,6 +218,18 @@ public abstract class SyncProvider<TYPE extends SyncContainer> {
readRemotelyUpdated(data);
}
@SuppressWarnings("nls")
protected String getFinalSyncStatus() {
if (getUtilities().getLastError() != null || getUtilities().getLastAttemptedSyncDate() != 0) {
if (getUtilities().getLastAttemptedSyncDate() == 0)
return "errors";
else
return "failed";
} else {
return "success";
}
}
protected void readRemotelyUpdated(SyncData<TYPE> data) throws IOException {
int length;
// Rearrange remoteTasks so completed tasks get synchronized first.

@ -124,7 +124,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
protected void performSync() {
actFmPreferenceService.recordSyncStart();
boolean syncSuccess = false;
String syncSuccess = "failed";
try {
int serverTime = Preferences.getInt(ActFmPreferenceService.PREF_SERVER_TIME, 0);
@ -145,7 +145,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
Preferences.setInt(ActFmPreferenceService.PREF_SERVER_TIME, newServerTime);
actFmPreferenceService.recordSuccessfulSync();
syncSuccess = true;
syncSuccess = getFinalSyncStatus();
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_EVENT_REFRESH);
ContextManager.getContext().sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
@ -155,7 +155,7 @@ public class ActFmSyncProvider extends SyncProvider<ActFmTaskContainer> {
handleException("actfm-sync", e, false); //$NON-NLS-1$
} finally {
StatisticsService.reportEvent(StatisticsConstants.ACTFM_SYNC_FINISHED,
"success", Boolean.toString(syncSuccess)); //$NON-NLS-1$
"success", syncSuccess); //$NON-NLS-1$
}
}

@ -159,7 +159,7 @@ public class GtasksSyncProvider extends SyncProvider<GtasksTaskContainer> {
// ----------------------------------------------------------------------
protected void performSync() {
boolean syncSuccess = false;
String syncSuccess = "failed";
gtasksPreferenceService.recordSyncStart();
if(Constants.DEBUG)
Log.e("gtasks-debug", "- -------- SYNC STARTED");
@ -196,14 +196,15 @@ public class GtasksSyncProvider extends SyncProvider<GtasksTaskContainer> {
ContextManager.getContext().sendBroadcast(broadcastIntent, AstridApiConstants.PERMISSION_READ);
if(Constants.DEBUG)
Log.e("gtasks-debug", "- ------ SYNC FINISHED");
syncSuccess = true;
syncSuccess = getFinalSyncStatus();
} catch (IllegalStateException e) {
// occurs when application was closed
} catch (IOException e) {
handleException("gtasks-sync", e, true); //$NON-NLS-1$
} finally {
StatisticsService.reportEvent(StatisticsConstants.GTASKS_SYNC_FINISHED,
"success", Boolean.toString(syncSuccess)); //$NON-NLS-1$
"success", syncSuccess); //$NON-NLS-1$
}
}

@ -180,7 +180,7 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
protected void performSync() {
preferences.recordSyncStart();
boolean syncSuccess = false;
String syncSuccess = "failed";
try {
// load user information
@ -245,14 +245,14 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
// notification/activities stuff
processNotifications();
syncSuccess = true;
syncSuccess = getFinalSyncStatus();
} catch (IllegalStateException e) {
// occurs when application was closed
} catch (Exception e) {
handleException("pdv-sync", e, true); //$NON-NLS-1$
} finally {
StatisticsService.reportEvent(StatisticsConstants.PDV_SYNC_FINISHED,
"success", Boolean.toString(syncSuccess)); //$NON-NLS-1$
"success", syncSuccess); //$NON-NLS-1$
}
}

Loading…
Cancel
Save