Fix date format
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
14300266ef
commit
361057aa9f
|
@ -120,9 +120,9 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "", "");
|
loadedCurrentUser = User(int.tryParse(currentUser), "", "");
|
||||||
} catch (otherExceptions) {
|
} catch (otherExceptions) {
|
||||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "", "");
|
loadedCurrentUser = User(int.tryParse(currentUser), "", "");
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
_client = client;
|
_client = client;
|
||||||
|
|
|
@ -23,8 +23,8 @@ class TaskList {
|
||||||
owner = User.fromJson(json['owner']),
|
owner = User.fromJson(json['owner']),
|
||||||
description = json['description'],
|
description = json['description'],
|
||||||
title = json['title'],
|
title = json['title'],
|
||||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
updated = DateTime.parse(json['updated']),
|
||||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
created = DateTime.parse(json['created']),
|
||||||
tasks = (json['tasks'] == null ? [] : json['tasks'] as List<dynamic>)
|
tasks = (json['tasks'] == null ? [] : json['tasks'] as List<dynamic>)
|
||||||
?.map((taskJson) => Task.fromJson(taskJson))
|
?.map((taskJson) => Task.fromJson(taskJson))
|
||||||
?.toList();
|
?.toList();
|
||||||
|
@ -35,8 +35,8 @@ class TaskList {
|
||||||
"title": this.title,
|
"title": this.title,
|
||||||
"description": this.description,
|
"description": this.description,
|
||||||
"owner": this.owner?.toJSON(),
|
"owner": this.owner?.toJSON(),
|
||||||
"created": this.created?.millisecondsSinceEpoch,
|
"created": this.created?.toIso8601String(),
|
||||||
"updated": this.updated?.millisecondsSinceEpoch,
|
"updated": this.updated?.toIso8601String(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ class Namespace {
|
||||||
: name = json['name'],
|
: name = json['name'],
|
||||||
description = json['description'],
|
description = json['description'],
|
||||||
id = json['id'],
|
id = json['id'],
|
||||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
created = DateTime.parse(json['created']),
|
||||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
updated = DateTime.parse(json['updated']),
|
||||||
owner = User.fromJson(json['owner']);
|
owner = User.fromJson(json['owner']);
|
||||||
|
|
||||||
toJSON() => {
|
toJSON() => {
|
||||||
"created": created?.millisecondsSinceEpoch,
|
"created": created?.toIso8601String(),
|
||||||
"updated": updated?.millisecondsSinceEpoch,
|
"updated": updated?.toIso8601String(),
|
||||||
"name": name,
|
"name": name,
|
||||||
"owner": owner?.toJSON(),
|
"owner": owner?.toJSON(),
|
||||||
"description": description
|
"description": description
|
||||||
|
|
|
@ -22,12 +22,12 @@ class Task {
|
||||||
|
|
||||||
Task.fromJson(Map<String, dynamic> json)
|
Task.fromJson(Map<String, dynamic> json)
|
||||||
: id = json['id'],
|
: id = json['id'],
|
||||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
updated = DateTime.parse(json['updated']),
|
||||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
created = DateTime.parse(json['created']),
|
||||||
reminders = (json['reminderDates'] as List<dynamic>)
|
reminders = (json['reminderDates'] as List<dynamic>)
|
||||||
?.map((milli) => DateTime.fromMillisecondsSinceEpoch(milli))
|
?.map((r) => DateTime.parse(r))
|
||||||
?.toList(),
|
?.toList(),
|
||||||
due = DateTime.fromMillisecondsSinceEpoch(json['dueDate']),
|
due = DateTime.parse(json['dueDate']),
|
||||||
description = json['description'],
|
description = json['description'],
|
||||||
text = json['text'],
|
text = json['text'],
|
||||||
done = json['done'],
|
done = json['done'],
|
||||||
|
@ -35,11 +35,11 @@ class Task {
|
||||||
|
|
||||||
toJSON() => {
|
toJSON() => {
|
||||||
'id': id,
|
'id': id,
|
||||||
'updated': updated?.millisecondsSinceEpoch,
|
'updated': updated?.toIso8601String(),
|
||||||
'created': created?.millisecondsSinceEpoch,
|
'created': created?.toIso8601String(),
|
||||||
'reminderDates':
|
'reminderDates':
|
||||||
reminders?.map((date) => date.millisecondsSinceEpoch)?.toList(),
|
reminders?.map((date) => date.toIso8601String())?.toList(),
|
||||||
'dueDate': due?.millisecondsSinceEpoch,
|
'dueDate': due?.toIso8601String(),
|
||||||
'description': description,
|
'description': description,
|
||||||
'text': text,
|
'text': text,
|
||||||
'done': done ?? false,
|
'done': done ?? false,
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:vikunja_app/global.dart';
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
final int id;
|
final int id;
|
||||||
final String email, username, avatarHash;
|
final String email, username;
|
||||||
|
|
||||||
User(this.id, this.email, this.username, this.avatarHash);
|
User(this.id, this.email, this.username);
|
||||||
User.fromJson(Map<String, dynamic> json)
|
User.fromJson(Map<String, dynamic> json)
|
||||||
: id = json['id'],
|
: id = json['id'],
|
||||||
email = json.containsKey('email') ? json['email'] : '',
|
email = json.containsKey('email') ? json['email'] : '',
|
||||||
username = json['username'],
|
username = json['username'];
|
||||||
avatarHash = json['avatarUrl'];
|
|
||||||
|
|
||||||
toJSON() => {"id": this.id, "email": this.email, "username": this.username};
|
toJSON() => {"id": this.id, "email": this.email, "username": this.username};
|
||||||
|
|
||||||
String avatarUrl() {
|
String avatarUrl(BuildContext context) {
|
||||||
return "https://secure.gravatar.com/avatar/" + this.avatarHash;
|
return VikunjaGlobal.of(context).client.base + "/" + this.username + "/avatar";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class HomePageState extends State<HomePage> with AfterLayoutMixin<HomePage> {
|
||||||
currentAccountPicture: currentUser == null
|
currentAccountPicture: currentUser == null
|
||||||
? null
|
? null
|
||||||
: CircleAvatar(
|
: CircleAvatar(
|
||||||
backgroundImage: NetworkImage(currentUser.avatarUrl()),
|
backgroundImage: NetworkImage(currentUser.avatarUrl(context)),
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
|
|
|
@ -7,7 +7,7 @@ import 'package:vikunja_app/models/user.dart';
|
||||||
import 'package:vikunja_app/service/services.dart';
|
import 'package:vikunja_app/service/services.dart';
|
||||||
|
|
||||||
// Data for mocked services
|
// Data for mocked services
|
||||||
var _users = {1: User(1, 'test@testuser.org', 'test1', '')};
|
var _users = {1: User(1, 'test@testuser.org', 'test1')};
|
||||||
|
|
||||||
var _namespaces = {
|
var _namespaces = {
|
||||||
1: Namespace(
|
1: Namespace(
|
||||||
|
|
Reference in New Issue