|
| 1 | +// ignore_for_file: lines_longer_than_80_chars |
| 2 | + |
1 | 3 | import 'dart:async'; |
2 | 4 |
|
3 | | -import 'package:ht_auth_client/ht_auth_client.dart'; |
4 | | -import 'package:ht_shared/ht_shared.dart'; |
| 5 | +import 'package:auth_client/auth_client.dart'; |
| 6 | +import 'package:core/core.dart'; |
5 | 7 | import 'package:logging/logging.dart'; |
6 | 8 | import 'package:uuid/uuid.dart'; |
7 | 9 |
|
8 | | -/// {@template ht_auth_inmemory} |
9 | | -/// An in-memory implementation of the [HtAuthClient] interface for |
| 10 | +/// {@template auth_inmemory} |
| 11 | +/// An in-memory implementation of the [AuthClient] interface for |
10 | 12 | /// demonstration and testing purposes. |
11 | 13 | /// |
12 | 14 | /// This client simulates authentication flows without requiring a backend, |
13 | 15 | /// managing user and token states purely in memory. |
14 | 16 | /// {@endtemplate} |
15 | | -class HtAuthInmemory implements HtAuthClient { |
16 | | - /// {@macro ht_auth_inmemory} |
17 | | - HtAuthInmemory({this.initialUser, this.initialToken, Logger? logger}) |
18 | | - : _logger = logger ?? Logger('HtAuthInmemory') { |
| 17 | +class AuthInmemory implements AuthClient { |
| 18 | + /// {@macro auth_inmemory} |
| 19 | + AuthInmemory({this.initialUser, this.initialToken, Logger? logger}) |
| 20 | + : _logger = logger ?? Logger('AuthInmemory') { |
19 | 21 | _logger.fine( |
20 | 22 | 'Initializing with initialUser: $initialUser, ' |
21 | 23 | 'initialToken: $initialToken', |
@@ -156,10 +158,11 @@ class HtAuthInmemory implements HtAuthClient { |
156 | 158 | _authStateController.add(_currentUser); |
157 | 159 | _pendingCodes.remove(email); |
158 | 160 |
|
159 | | - _logger.info( |
160 | | - 'User $email verified. New user: $_currentUser, token: $_currentToken', |
161 | | - ); |
162 | | - _logger.finer('Pending codes after verification: $_pendingCodes'); |
| 161 | + _logger |
| 162 | + ..info( |
| 163 | + 'User $email verified. New user: $_currentUser, token: $_currentToken', |
| 164 | + ) |
| 165 | + ..finer('Pending codes after verification: $_pendingCodes'); |
163 | 166 | await Future<void>.delayed(const Duration(milliseconds: 500)); |
164 | 167 | _logger.fine('verifySignInCode completed for email: $email'); |
165 | 168 | return AuthSuccessResponse(user: user, token: _currentToken!); |
@@ -201,10 +204,11 @@ class HtAuthInmemory implements HtAuthClient { |
201 | 204 | _authStateController.add(null); |
202 | 205 | _pendingCodes.clear(); |
203 | 206 |
|
204 | | - _logger.info( |
205 | | - 'User signed out. Current user: $_currentUser, token: $_currentToken', |
206 | | - ); |
207 | | - _logger.finer('Pending codes after sign out: $_pendingCodes'); |
| 207 | + _logger |
| 208 | + ..info( |
| 209 | + 'User signed out. Current user: $_currentUser, token: $_currentToken', |
| 210 | + ) |
| 211 | + ..finer('Pending codes after sign out: $_pendingCodes'); |
208 | 212 | await Future<void>.delayed(const Duration(milliseconds: 500)); |
209 | 213 | _logger.fine('signOut completed.'); |
210 | 214 | } |
|
0 commit comments