feat: Refactor repositories and modules to remove FirebaseAuth dependency and utilize DataConnectService
This commit is contained in:
@@ -1,23 +1,21 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:krow_data_connect/krow_data_connect.dart' as dc;
|
||||
|
||||
import '../../domain/repositories/settings_repository_interface.dart';
|
||||
|
||||
/// Implementation of [SettingsRepositoryInterface].
|
||||
///
|
||||
/// This implementation delegates authentication operations to [FirebaseAuth].
|
||||
/// This implementation delegates authentication operations to [DataConnectService].
|
||||
class SettingsRepositoryImpl implements SettingsRepositoryInterface {
|
||||
/// Creates a [SettingsRepositoryImpl] with the required [_firebaseAuth].
|
||||
const SettingsRepositoryImpl({required this.firebaseAuth});
|
||||
/// Creates a [SettingsRepositoryImpl] with the required [_service].
|
||||
const SettingsRepositoryImpl({required dc.DataConnectService service}) : _service = service;
|
||||
|
||||
/// The Firebase Auth instance.
|
||||
final FirebaseAuth firebaseAuth;
|
||||
/// The Data Connect service.
|
||||
final dc.DataConnectService _service;
|
||||
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
await firebaseAuth.signOut();
|
||||
} catch (e) {
|
||||
throw Exception('Error signing out: ${e.toString()}');
|
||||
}
|
||||
return _service.run(() async {
|
||||
await _service.auth.signOut();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user