Added allDay flag for Producteev setDeadline, fixed unsetting deadline

pull/14/head
Tim Su 16 years ago
parent 1cb46c83fc
commit e6bce4d275

@ -242,14 +242,16 @@ public class ProducteevInvoker {
*
* @param idTask
* @param deadline
* @param allDay (optional), 1: all day task (time specified in deadline will be ignored), 0: deadline with time
*
* @return array tasks/view
*/
public JSONObject tasksSetDeadline(long idTask, String deadline) throws ApiServiceException, IOException {
public JSONObject tasksSetDeadline(long idTask, String deadline, Integer allDay) throws ApiServiceException, IOException {
return callAuthenticated("tasks/set_deadline.json",
"token", token,
"id_task", idTask,
"deadline", deadline);
"deadline", deadline,
"all_day", allDay);
}
/**

@ -519,7 +519,7 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
if(shouldTransmit(local, Task.IMPORTANCE, remote))
invoker.tasksSetStar(idTask, createStars(local.task));
if(shouldTransmit(local, Task.DUE_DATE, remote))
invoker.tasksSetDeadline(idTask, createDeadline(local.task));
invoker.tasksSetDeadline(idTask, createDeadline(local.task), local.task.hasDueTime() ? 0 : 1);
if(shouldTransmit(local, Task.COMPLETION_DATE, remote))
invoker.tasksSetStatus(idTask, local.task.isCompleted() ? 2 : 1);
@ -661,7 +661,7 @@ public class ProducteevSyncProvider extends SyncProvider<ProducteevTaskContainer
*/
private String createDeadline(Task task) {
if(!task.hasDueDate())
return null;
return "";
if(!task.hasDueTime())
return ApiUtilities.unixDateToProducteev(task.getValue(Task.DUE_DATE));
String time = ApiUtilities.unixTimeToProducteev(task.getValue(Task.DUE_DATE));

@ -398,6 +398,8 @@ public final class Task extends AbstractModel {
* Checks whether this due date has a due time or only a date
*/
public boolean hasDueTime() {
if(!hasDueDate())
return false;
return hasDueTime(getValue(Task.DUE_DATE));
}

@ -230,7 +230,7 @@ public class TaskService {
public int clearDetails() {
Task task = new Task();
task.setValue(Task.DETAILS, null);
return taskDao.updateMultiple(task, Task.DETAILS.isNotNull());
return taskDao.updateMultiple(task, Criterion.all);
}
/**

Loading…
Cancel
Save