Skip to content

Commit 15f88c1

Browse files
committed
feat(authentication): add cooldownEndTime to AuthenticationState
- Add cooldownEndTime field to track the end time of cooldown for requesting a new code - Update copyWith method to include cooldownEndTime parameter and clearCooldownEndTime option - Modify props list to include cooldownEndTime
1 parent eb08970 commit 15f88c1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/authentication/bloc/authentication_state.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class AuthenticationState extends Equatable {
3939
this.user,
4040
this.email,
4141
this.exception,
42+
this.cooldownEndTime,
4243
});
4344

4445
/// The current status of the authentication process.
@@ -53,21 +54,28 @@ class AuthenticationState extends Equatable {
5354
/// The exception that occurred, if any.
5455
final HttpException? exception;
5556

57+
/// The time when the cooldown for requesting a new code ends.
58+
final DateTime? cooldownEndTime;
59+
5660
/// Creates a copy of the current [AuthenticationState] with updated values.
5761
AuthenticationState copyWith({
5862
AuthenticationStatus? status,
5963
User? user,
6064
String? email,
6165
HttpException? exception,
66+
DateTime? cooldownEndTime,
67+
bool clearCooldownEndTime = false,
6268
}) {
6369
return AuthenticationState(
6470
status: status ?? this.status,
6571
user: user ?? this.user,
6672
email: email ?? this.email,
6773
exception: exception ?? this.exception,
74+
cooldownEndTime:
75+
clearCooldownEndTime ? null : cooldownEndTime ?? this.cooldownEndTime,
6876
);
6977
}
7078

7179
@override
72-
List<Object?> get props => [status, user, email, exception];
80+
List<Object?> get props => [status, user, email, exception, cooldownEndTime];
7381
}

0 commit comments

Comments
 (0)