when RTM repeating task is completed, Astrid automatically picks up the new task without having to re-sync

pull/14/head
Tim Su 14 years ago
parent 7eee8cddaf
commit 49d1a8bbbf

@ -15,8 +15,8 @@ import android.content.Context;
import android.widget.Toast;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.service.ExceptionService;

@ -367,6 +367,13 @@ public class RTMSyncProvider extends SynchronizationProvider<RTMTaskContainer> {
return true;
if(!remoteTask.task.containsValue(property))
return true;
// special cases - match if they're zero or nonzero
if(property == Task.COMPLETION_DATE ||
property == Task.DELETION_DATE)
return !AndroidUtilities.equals((Long)task.task.getValue(property) == 0,
(Long)remoteTask.task.getValue(property) == 0);
return !AndroidUtilities.equals(task.task.getValue(property),
remoteTask.task.getValue(property));
}
@ -378,6 +385,8 @@ public class RTMSyncProvider extends SynchronizationProvider<RTMTaskContainer> {
*/
@Override
protected void push(RTMTaskContainer local, RTMTaskContainer remote) throws IOException {
boolean remerge = false;
// fetch remote task for comparison
if(remote == null)
remote = pull(local);
@ -416,9 +425,13 @@ public class RTMSyncProvider extends SynchronizationProvider<RTMTaskContainer> {
if(local.task.getValue(Task.COMPLETION_DATE) == 0)
rtmService.tasks_uncomplete(timeline, listId, taskSeriesId,
taskId);
else
else {
rtmService.tasks_complete(timeline, listId, taskSeriesId,
taskId);
// if repeating, pull and merge
if(local.repeating)
remerge = true;
}
}
// tags
@ -452,7 +465,12 @@ public class RTMSyncProvider extends SynchronizationProvider<RTMTaskContainer> {
rtmService.tasks_notes_add(timeline, listId, taskSeriesId,
taskId, titleAndText[0], titleAndText[1]);
}
}
if(remerge) {
remote = pull(local);
remote.task.setId(local.task.getId());
write(remote);
}
}

@ -7,7 +7,7 @@
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:paddingLeft="4dip"
android:paddingRight="6dip"
android:paddingRight="10dip"
android:orientation="vertical">
<LinearLayout android:id="@+id/task_row"

Loading…
Cancel
Save