mirror of
https://github.com/immich-app/immich.git
synced 2024-12-19 00:32:49 +02:00
40a8115101
* Fixed app not resuming backup after closing and reopening the app * Fixed cosmetic effect of backup button doesn't change state right away after pressing start backup * Fixed grammar * Fixed deep copy problem that cause incorrect asset count when backing up * Format code
77 lines
1.7 KiB
Dart
77 lines
1.7 KiB
Dart
import 'dart:convert';
|
|
|
|
class User {
|
|
final String id;
|
|
final String email;
|
|
final String createdAt;
|
|
final String firstName;
|
|
final String lastName;
|
|
|
|
User({
|
|
required this.id,
|
|
required this.email,
|
|
required this.createdAt,
|
|
required this.firstName,
|
|
required this.lastName,
|
|
});
|
|
|
|
User copyWith({
|
|
String? id,
|
|
String? email,
|
|
String? createdAt,
|
|
String? firstName,
|
|
String? lastName,
|
|
}) {
|
|
return User(
|
|
id: id ?? this.id,
|
|
email: email ?? this.email,
|
|
createdAt: createdAt ?? this.createdAt,
|
|
firstName: firstName ?? this.firstName,
|
|
lastName: lastName ?? this.lastName,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
final result = <String, dynamic>{};
|
|
|
|
result.addAll({'id': id});
|
|
result.addAll({'email': email});
|
|
result.addAll({'createdAt': createdAt});
|
|
|
|
return result;
|
|
}
|
|
|
|
factory User.fromMap(Map<String, dynamic> map) {
|
|
return User(
|
|
id: map['id'] ?? '',
|
|
email: map['email'] ?? '',
|
|
createdAt: map['createdAt'] ?? '',
|
|
firstName: map['firstName'] ?? '',
|
|
lastName: map['lastName'] ?? '',
|
|
);
|
|
}
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory User.fromJson(String source) => User.fromMap(json.decode(source));
|
|
|
|
@override
|
|
String toString() =>
|
|
'UserInfo(id: $id, email: $email, createdAt: $createdAt)';
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return other is User &&
|
|
other.id == id &&
|
|
other.email == email &&
|
|
other.createdAt == createdAt &&
|
|
other.firstName == firstName &&
|
|
other.lastName == lastName;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => id.hashCode ^ email.hashCode ^ createdAt.hashCode;
|
|
}
|