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 d94da21a7..d376054a7 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncService.java @@ -261,7 +261,8 @@ public final class ActFmSyncService { if(!newlyCreated) { params.add("id"); params.add(remoteId); - } + } else if(!values.containsKey(Task.TITLE.name)) + return; try { params.add("token"); params.add(token); diff --git a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java index fdcbd078e..210ce819e 100644 --- a/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java +++ b/astrid/plugin-src/com/todoroo/astrid/repeats/RepeatTaskCompleteListener.java @@ -16,8 +16,11 @@ import com.google.ical.values.DateValue; import com.google.ical.values.DateValueImpl; import com.google.ical.values.Frequency; import com.google.ical.values.RRule; +import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.ContextManager; +import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.utility.DateUtilities; +import com.todoroo.astrid.actfm.sync.ActFmPreferenceService; import com.todoroo.astrid.api.AstridApiConstants; import com.todoroo.astrid.core.PluginServices; import com.todoroo.astrid.data.Task; @@ -26,9 +29,12 @@ import com.todoroo.astrid.utility.Flags; public class RepeatTaskCompleteListener extends BroadcastReceiver { + @Autowired ActFmPreferenceService actFmPreferenceService; + @Override public void onReceive(Context context, Intent intent) { ContextManager.setContext(context); + DependencyInjectionService.getInstance().inject(this); long taskId = intent.getLongExtra(AstridApiConstants.EXTRAS_TASK_ID, -1); if(taskId == -1) return; @@ -38,10 +44,6 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver { if(task == null) return; - // don't repeat when it repeats on the server - if(task.getValue(Task.REMOTE_ID) > 0) - return; - String recurrence = task.getValue(Task.RECURRENCE); if(recurrence != null && recurrence.length() > 0) { long newDueDate; @@ -61,6 +63,15 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver { hideUntil += newDueDate - task.getValue(Task.DUE_DATE); } + // update repeat time when it repeats on the server + if(actFmPreferenceService.isLoggedIn()) { + task.setValue(Task.COMPLETION_DATE, 0L); + task.setValue(Task.DUE_DATE, newDueDate); + task.setValue(Task.HIDE_UNTIL, hideUntil); + PluginServices.getTaskService().save(task); + return; + } + // clone to create new task Task clone = PluginServices.getTaskService().clone(task); clone.setValue(Task.DUE_DATE, newDueDate); diff --git a/astrid/src/com/todoroo/astrid/service/TaskService.java b/astrid/src/com/todoroo/astrid/service/TaskService.java index 0470aaf1e..75e6a3bf1 100644 --- a/astrid/src/com/todoroo/astrid/service/TaskService.java +++ b/astrid/src/com/todoroo/astrid/service/TaskService.java @@ -106,7 +106,6 @@ public class TaskService { return new Task(); newTask.clearValue(Task.ID); newTask.clearValue(Task.REMOTE_ID); - taskDao.createNew(newTask); TodorooCursor cursor = metadataDao.query( Query.select(Metadata.PROPERTIES).where(MetadataCriteria.byTask(task.getId()))); try {