Fixed app not working with the newest api change which has multiple reminders #19
|
@ -24,7 +24,7 @@ class Task {
|
|||
: id = json['id'],
|
||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
||||
reminders = makeDateTimesFromJSON(json['reminderDates'] as List<dynamic>),
|
||||
reminders = (json['reminderDates'] as List<dynamic>)?.map((milli) => DateTime.fromMillisecondsSinceEpoch(milli))?.toList(),
|
||||
due = DateTime.fromMillisecondsSinceEpoch(json['dueDate']),
|
||||
description = json['description'],
|
||||
text = json['text'],
|
||||
|
@ -35,7 +35,7 @@ class Task {
|
|||
'id': id,
|
||||
'updated': updated?.millisecondsSinceEpoch,
|
||||
'created': created?.millisecondsSinceEpoch,
|
||||
'reminderDates': reminders?.toList(),
|
||||
'reminderDates': reminders?.map((date) => date.millisecondsSinceEpoch)?.toList(),
|
||||
|
||||
'dueDate': due?.millisecondsSinceEpoch,
|
||||
'description': description,
|
||||
'text': text,
|
||||
|
@ -81,17 +81,3 @@ class TaskList {
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
List<DateTime> makeDateTimesFromJSON(List<dynamic> json) {
|
||||
|
||||
List<DateTime> dates = new List<DateTime>();
|
||||
if(json == null) {
|
||||
return dates;
|
||||
}
|
||||
|
||||
for(var i = 0; i < json.length; i++) {
|
||||
dates.add(DateTime.fromMillisecondsSinceEpoch(json[i]));
|
||||
}
|
||||
|
||||
return dates;
|
||||
}
|
||||
|
|
Reference in New Issue
The reminders should be transfered into an unix timestamp.
Use something like that:
Fixed.