mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
Implemented user profile upload and show on web/mobile (#191)
* Update mobile dependencies * Added image picker * Added mechanism to upload profile image * Added image type to send to web * Added styling for circle avatar * Fixxed issue with sharp cannot resize image properly * Finished displaying and uploading user profile * Added user profile to web
This commit is contained in:
parent
bdf38e7668
commit
d476b15312
17 changed files with 579 additions and 86 deletions
|
|
@ -4,31 +4,58 @@ class LogInReponse {
|
|||
final String accessToken;
|
||||
final String userId;
|
||||
final String userEmail;
|
||||
final String firstName;
|
||||
final String lastName;
|
||||
final String profileImagePath;
|
||||
final bool isAdmin;
|
||||
final bool isFirstLogin;
|
||||
|
||||
LogInReponse({
|
||||
required this.accessToken,
|
||||
required this.userId,
|
||||
required this.userEmail,
|
||||
required this.firstName,
|
||||
required this.lastName,
|
||||
required this.profileImagePath,
|
||||
required this.isAdmin,
|
||||
required this.isFirstLogin,
|
||||
});
|
||||
|
||||
LogInReponse copyWith({
|
||||
String? accessToken,
|
||||
String? userId,
|
||||
String? userEmail,
|
||||
String? firstName,
|
||||
String? lastName,
|
||||
String? profileImagePath,
|
||||
bool? isAdmin,
|
||||
bool? isFirstLogin,
|
||||
}) {
|
||||
return LogInReponse(
|
||||
accessToken: accessToken ?? this.accessToken,
|
||||
userId: userId ?? this.userId,
|
||||
userEmail: userEmail ?? this.userEmail,
|
||||
firstName: firstName ?? this.firstName,
|
||||
lastName: lastName ?? this.lastName,
|
||||
profileImagePath: profileImagePath ?? this.profileImagePath,
|
||||
isAdmin: isAdmin ?? this.isAdmin,
|
||||
isFirstLogin: isFirstLogin ?? this.isFirstLogin,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
'accessToken': accessToken,
|
||||
'userId': userId,
|
||||
'userEmail': userEmail,
|
||||
};
|
||||
final result = <String, dynamic>{};
|
||||
|
||||
result.addAll({'accessToken': accessToken});
|
||||
result.addAll({'userId': userId});
|
||||
result.addAll({'userEmail': userEmail});
|
||||
result.addAll({'firstName': firstName});
|
||||
result.addAll({'lastName': lastName});
|
||||
result.addAll({'profileImagePath': profileImagePath});
|
||||
result.addAll({'isAdmin': isAdmin});
|
||||
result.addAll({'isFirstLogin': isFirstLogin});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
factory LogInReponse.fromMap(Map<String, dynamic> map) {
|
||||
|
|
@ -36,6 +63,11 @@ class LogInReponse {
|
|||
accessToken: map['accessToken'] ?? '',
|
||||
userId: map['userId'] ?? '',
|
||||
userEmail: map['userEmail'] ?? '',
|
||||
firstName: map['firstName'] ?? '',
|
||||
lastName: map['lastName'] ?? '',
|
||||
profileImagePath: map['profileImagePath'] ?? '',
|
||||
isAdmin: map['isAdmin'] ?? false,
|
||||
isFirstLogin: map['isFirstLogin'] ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -44,7 +76,9 @@ class LogInReponse {
|
|||
factory LogInReponse.fromJson(String source) => LogInReponse.fromMap(json.decode(source));
|
||||
|
||||
@override
|
||||
String toString() => 'LogInReponse(accessToken: $accessToken, userId: $userId, userEmail: $userEmail)';
|
||||
String toString() {
|
||||
return 'LogInReponse(accessToken: $accessToken, userId: $userId, userEmail: $userEmail, firstName: $firstName, lastName: $lastName, profileImagePath: $profileImagePath, isAdmin: $isAdmin, isFirstLogin: $isFirstLogin)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
|
|
@ -53,9 +87,23 @@ class LogInReponse {
|
|||
return other is LogInReponse &&
|
||||
other.accessToken == accessToken &&
|
||||
other.userId == userId &&
|
||||
other.userEmail == userEmail;
|
||||
other.userEmail == userEmail &&
|
||||
other.firstName == firstName &&
|
||||
other.lastName == lastName &&
|
||||
other.profileImagePath == profileImagePath &&
|
||||
other.isAdmin == isAdmin &&
|
||||
other.isFirstLogin == isFirstLogin;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => accessToken.hashCode ^ userId.hashCode ^ userEmail.hashCode;
|
||||
int get hashCode {
|
||||
return accessToken.hashCode ^
|
||||
userId.hashCode ^
|
||||
userEmail.hashCode ^
|
||||
firstName.hashCode ^
|
||||
lastName.hashCode ^
|
||||
profileImagePath.hashCode ^
|
||||
isAdmin.hashCode ^
|
||||
isFirstLogin.hashCode;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue