1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 10:56:47 +01:00
immich/mobile/lib/models/authentication/authentication_state.model.dart
Alex f057fe045e
refactor(mobile): entities and models (#9182)
* refactor(mobile): entities

* store entity

* refactor: models

* remove domain

* save all

* bad refactor
2024-04-30 21:36:40 -05:00

74 lines
2.2 KiB
Dart

class AuthenticationState {
final String deviceId;
final String userId;
final String userEmail;
final bool isAuthenticated;
final String name;
final bool isAdmin;
final bool shouldChangePassword;
final String profileImagePath;
AuthenticationState({
required this.deviceId,
required this.userId,
required this.userEmail,
required this.isAuthenticated,
required this.name,
required this.isAdmin,
required this.shouldChangePassword,
required this.profileImagePath,
});
AuthenticationState copyWith({
String? deviceId,
String? userId,
String? userEmail,
bool? isAuthenticated,
String? name,
bool? isAdmin,
bool? shouldChangePassword,
String? profileImagePath,
}) {
return AuthenticationState(
deviceId: deviceId ?? this.deviceId,
userId: userId ?? this.userId,
userEmail: userEmail ?? this.userEmail,
isAuthenticated: isAuthenticated ?? this.isAuthenticated,
name: name ?? this.name,
isAdmin: isAdmin ?? this.isAdmin,
shouldChangePassword: shouldChangePassword ?? this.shouldChangePassword,
profileImagePath: profileImagePath ?? this.profileImagePath,
);
}
@override
String toString() {
return 'AuthenticationState(deviceId: $deviceId, userId: $userId, userEmail: $userEmail, isAuthenticated: $isAuthenticated, name: $name, isAdmin: $isAdmin, shouldChangePassword: $shouldChangePassword, profileImagePath: $profileImagePath)';
}
@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
return other is AuthenticationState &&
other.deviceId == deviceId &&
other.userId == userId &&
other.userEmail == userEmail &&
other.isAuthenticated == isAuthenticated &&
other.name == name &&
other.isAdmin == isAdmin &&
other.shouldChangePassword == shouldChangePassword &&
other.profileImagePath == profileImagePath;
}
@override
int get hashCode {
return deviceId.hashCode ^
userId.hashCode ^
userEmail.hashCode ^
isAuthenticated.hashCode ^
name.hashCode ^
isAdmin.hashCode ^
shouldChangePassword.hashCode ^
profileImagePath.hashCode;
}
}