add logs
This commit is contained in:
@@ -14,6 +14,7 @@ import 'package:worker/core/services/frappe_auth_service.dart';
|
||||
import 'package:worker/features/auth/data/datasources/auth_local_datasource.dart';
|
||||
import 'package:worker/features/auth/data/datasources/auth_remote_datasource.dart';
|
||||
import 'package:worker/features/auth/domain/entities/user.dart';
|
||||
import 'package:worker/core/services/analytics_service.dart';
|
||||
|
||||
part 'auth_provider.g.dart';
|
||||
|
||||
@@ -182,6 +183,11 @@ class Auth extends _$Auth {
|
||||
// Save rememberMe preference
|
||||
await _localDataSource.saveRememberMe(rememberMe);
|
||||
|
||||
// Set user ID for analytics tracking
|
||||
await AnalyticsService.setUserId(phoneNumber);
|
||||
// Log login event
|
||||
await AnalyticsService.logLogin(method: 'phone');
|
||||
|
||||
// Create and return User entity
|
||||
final now = DateTime.now();
|
||||
return User(
|
||||
@@ -218,6 +224,9 @@ class Auth extends _$Auth {
|
||||
state = await AsyncValue.guard(() async {
|
||||
final frappeService = await _frappeAuthService;
|
||||
|
||||
// Clear user ID from analytics
|
||||
await AnalyticsService.setUserId(null);
|
||||
|
||||
// Clear saved session
|
||||
await _localDataSource.clearSession();
|
||||
await frappeService.clearSession();
|
||||
|
||||
@@ -272,7 +272,7 @@ final class AuthProvider extends $AsyncNotifierProvider<Auth, User?> {
|
||||
Auth create() => Auth();
|
||||
}
|
||||
|
||||
String _$authHash() => r'd851980cad7a624f00eba69e19d8a4fee22008e7';
|
||||
String _$authHash() => r'f1d856a9a8fc461da111699e3c7ca2af1f2ce7ca';
|
||||
|
||||
/// Authentication Provider
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user