Make it build again #38
|
@ -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;
|
||||||
|
|
|
@ -1,22 +1,18 @@
|
||||||
import 'package:crypto/crypto.dart';
|
|
||||||
|
|
||||||
class User {
|
class User {
|
||||||
final int id;
|
final int id;
|
||||||
final String email, username;
|
final String email, username, avatarHash;
|
||||||
|
|
||||||
User(this.id, this.email, this.username);
|
User(this.id, this.email, this.username, this.avatarHash);
|
||||||
User.fromJson(Map<String, dynamic> json)
|
User.fromJson(Map<String, dynamic> json)
|
||||||
: id = json['id'],
|
: id = json['id'],
|
||||||
email = json['email'],
|
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() {
|
||||||
return "https://secure.gravatar.com/avatar/" +
|
return "https://secure.gravatar.com/avatar/" + this.avatarHash;
|
||||||
md5
|
|
||||||
.convert((this.email ?? "").trim().toLowerCase().codeUnits)
|
|
||||||
.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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