Make it build again #38

Merged
konrad merged 20 commits from fix/updated-fixes into master 2020-01-12 12:59:29 +00:00
3 changed files with 8 additions and 12 deletions
Showing only changes of commit 4d61a6e918 - Show all commits

View File

@ -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;

View File

@ -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();
} }
} }

View File

@ -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(