Skip to content

Commit b7de5cc

Browse files
committed
feat(auth_repository): add dashboard login flag to auth methods
Updates the HtAuthRepository to support the context-aware authentication flow by adding the optional `isDashboardLogin` parameter to the `requestSignInCode` and `verifySignInCode` methods. This change aligns the repository with the updated HtAuthClient interface and allows applications to signal a privileged dashboard login attempt. It also modernizes the `pubspec.yaml` dependencies.
1 parent 596ba31 commit b7de5cc

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

lib/src/ht_auth_repository.dart

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,43 @@ class HtAuthRepository {
5151

5252
/// Initiates the sign-in/sign-up process using the email+code flow.
5353
///
54+
/// This method is context-aware and can signal a dashboard login.
5455
/// Delegates to the underlying [HtAuthClient]'s method.
5556
///
5657
/// Throws [HtHttpException] or its subtypes on failure, as propagated
5758
/// from the client.
58-
Future<void> requestSignInCode(String email) async {
59+
Future<void> requestSignInCode(
60+
String email, {
61+
bool isDashboardLogin = false,
62+
}) async {
5963
try {
60-
await _authClient.requestSignInCode(email);
64+
await _authClient.requestSignInCode(
65+
email,
66+
isDashboardLogin: isDashboardLogin,
67+
);
6168
} on HtHttpException {
6269
rethrow; // Propagate client-level exceptions
6370
}
6471
}
6572

6673
/// Verifies the email code provided by the user and completes sign-in/sign-up.
6774
///
75+
/// This method is context-aware and can signal a dashboard login.
6876
/// Delegates to the underlying [HtAuthClient]'s method.
6977
///
7078
/// Throws [HtHttpException] or its subtypes on failure, as propagated
7179
/// from the client.
72-
Future<User> verifySignInCode(String email, String code) async {
80+
Future<User> verifySignInCode(
81+
String email,
82+
String code, {
83+
bool isDashboardLogin = false,
84+
}) async {
7385
try {
74-
final authResponse = await _authClient.verifySignInCode(email, code);
86+
final authResponse = await _authClient.verifySignInCode(
87+
email,
88+
code,
89+
isDashboardLogin: isDashboardLogin,
90+
);
7591
// authResponse is AuthSuccessResponse
7692
final token = authResponse.token;
7793
final user = authResponse.user;

0 commit comments

Comments
 (0)