Refactor settings to use FirebaseAuth for sign out

Replaces the previous mock-based authentication in client settings with FirebaseAuth for sign out functionality. Updates dependencies and imports accordingly, and adds firebase_auth to the settings package and firebase_core to the client app. Also includes minor Dart type improvements and dependency reordering.
This commit is contained in:
Achintha Isuru
2026-01-22 12:50:42 -05:00
parent 2325ba4032
commit c3f0282109
6 changed files with 47 additions and 41 deletions

View File

@@ -1,19 +1,23 @@
import 'package:krow_data_connect/krow_data_connect.dart';
import 'package:firebase_auth/firebase_auth.dart';
import '../../domain/repositories/settings_repository_interface.dart';
/// Implementation of [SettingsRepositoryInterface].
///
/// This implementation delegates data access to the [AuthRepositoryMock]
/// from the `data_connect` package.
/// This implementation delegates authentication operations to [FirebaseAuth].
class SettingsRepositoryImpl implements SettingsRepositoryInterface {
/// The auth mock from data connect.
final AuthRepositoryMock mock;
/// The Firebase Auth instance.
final FirebaseAuth _firebaseAuth;
/// Creates a [SettingsRepositoryImpl] with the required [mock].
SettingsRepositoryImpl({required this.mock});
/// Creates a [SettingsRepositoryImpl] with the required [_firebaseAuth].
SettingsRepositoryImpl({required FirebaseAuth firebaseAuth})
: _firebaseAuth = firebaseAuth;
@override
Future<void> signOut() {
return mock.signOut();
Future<void> signOut() async {
try {
await _firebaseAuth.signOut();
} catch (e) {
throw Exception('Error signing out: ${e.toString()}');
}
}
}