Skip to content

Commit af996cc

Browse files
committed
feat(authentication): add requestCodeCooldown status and cooldownEndTime prop
- Add requestCodeCooldown status to AuthenticationStatus enum - Add cooldownEndTime property to AuthenticationState - Update props list in AuthenticationState to include cooldownEndTime - Modify copyWith method to include cooldownEndTime parameter
1 parent 752d368 commit af996cc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/authentication/bloc/authentication_state.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ enum AuthenticationStatus {
2222
/// The sign-in code was sent successfully.
2323
codeSentSuccess,
2424

25+
/// The user is in a cooldown period after requesting a code.
26+
requestCodeCooldown,
27+
2528
/// An authentication operation failed.
2629
failure,
2730
}
@@ -36,6 +39,7 @@ final class AuthenticationState extends Equatable {
3639
this.user,
3740
this.email,
3841
this.exception,
42+
this.cooldownEndTime,
3943
});
4044

4145
/// The current status of the authentication process.
@@ -50,8 +54,11 @@ final class AuthenticationState extends Equatable {
5054
/// The error describing an authentication failure, if any.
5155
final HttpException? exception;
5256

57+
/// The time when the cooldown for requesting a new code ends.
58+
final DateTime? cooldownEndTime;
59+
5360
@override
54-
List<Object?> get props => [status, user, email, exception];
61+
List<Object?> get props => [status, user, email, exception, cooldownEndTime];
5562

5663
/// Creates a copy of this [AuthenticationState] with the given fields
5764
/// replaced with the new values.
@@ -60,12 +67,14 @@ final class AuthenticationState extends Equatable {
6067
User? user,
6168
String? email,
6269
HttpException? exception,
70+
DateTime? cooldownEndTime,
6371
}) {
6472
return AuthenticationState(
6573
status: status ?? this.status,
6674
user: user ?? this.user,
6775
email: email ?? this.email,
6876
exception: exception ?? this.exception,
77+
cooldownEndTime: cooldownEndTime ?? this.cooldownEndTime,
6978
);
7079
}
7180
}

0 commit comments

Comments
 (0)