feat: Refactor context reading in emergency contact and FAQs widgets
- Updated the context reading method in `EmergencyContactAddButton` and `EmergencyContactFormItem` to use `ReadContext`. - Modified the `FaqsWidget` to utilize `ReadContext` for fetching FAQs. - Adjusted the `PrivacySectionWidget` to read from `PrivacySecurityBloc` using `ReadContext`. feat: Implement Firebase Auth isolation pattern - Introduced `FirebaseAuthService` and `FirebaseAuthServiceImpl` to abstract Firebase Auth operations. - Ensured features do not directly import `firebase_auth`, adhering to architecture rules. feat: Create repository interfaces for billing and coverage - Added `BillingRepositoryInterface` for billing-related operations. - Created `CoverageRepositoryInterface` for coverage data access. feat: Add use cases for order management - Implemented use cases for fetching hubs, managers, and roles related to orders. - Created `GetHubsUseCase`, `GetManagersByHubUseCase`, and `GetRolesByVendorUseCase`. feat: Develop report use cases for client reports - Added use cases for fetching various reports including coverage, daily operations, forecast, no-show, performance, and spend reports. - Implemented `GetCoverageReportUseCase`, `GetDailyOpsReportUseCase`, `GetForecastReportUseCase`, `GetNoShowReportUseCase`, `GetPerformanceReportUseCase`, and `GetSpendReportUseCase`. feat: Establish profile repository and use cases - Created `ProfileRepositoryInterface` for staff profile data access. - Implemented use cases for retrieving staff profile and section statuses: `GetStaffProfileUseCase` and `GetProfileSectionsUseCase`. - Added `SignOutUseCase` for signing out the current user.
This commit is contained in:
@@ -21,7 +21,10 @@ class ClientSettingsModule extends Module {
|
||||
void binds(Injector i) {
|
||||
// Repositories
|
||||
i.addLazySingleton<SettingsRepositoryInterface>(
|
||||
() => SettingsRepositoryImpl(apiService: i.get<BaseApiService>()),
|
||||
() => SettingsRepositoryImpl(
|
||||
apiService: i.get<BaseApiService>(),
|
||||
firebaseAuthService: i.get<FirebaseAuthService>(),
|
||||
),
|
||||
);
|
||||
|
||||
// UseCases
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:developer' as developer;
|
||||
|
||||
import 'package:firebase_auth/firebase_auth.dart' as firebase;
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
@@ -8,16 +7,22 @@ import 'package:client_settings/src/domain/repositories/settings_repository_inte
|
||||
|
||||
/// Implementation of [SettingsRepositoryInterface].
|
||||
///
|
||||
/// Uses V2 API for server-side token revocation and Firebase Auth for local
|
||||
/// sign-out. Clears the [ClientSessionStore] on sign-out.
|
||||
/// Uses V2 API for server-side token revocation and [FirebaseAuthService]
|
||||
/// from core for local sign-out. Clears the [ClientSessionStore] on sign-out.
|
||||
class SettingsRepositoryImpl implements SettingsRepositoryInterface {
|
||||
/// Creates a [SettingsRepositoryImpl] with the required [BaseApiService].
|
||||
const SettingsRepositoryImpl({required BaseApiService apiService})
|
||||
: _apiService = apiService;
|
||||
/// Creates a [SettingsRepositoryImpl] with the required dependencies.
|
||||
const SettingsRepositoryImpl({
|
||||
required BaseApiService apiService,
|
||||
required FirebaseAuthService firebaseAuthService,
|
||||
}) : _apiService = apiService,
|
||||
_firebaseAuthService = firebaseAuthService;
|
||||
|
||||
/// The V2 API service for backend calls.
|
||||
final BaseApiService _apiService;
|
||||
|
||||
/// Core Firebase Auth service for local sign-out.
|
||||
final FirebaseAuthService _firebaseAuthService;
|
||||
|
||||
@override
|
||||
Future<void> signOut() async {
|
||||
try {
|
||||
@@ -31,8 +36,8 @@ class SettingsRepositoryImpl implements SettingsRepositoryInterface {
|
||||
// Continue with local sign-out even if server-side fails.
|
||||
}
|
||||
|
||||
// Step 2: Sign out from local Firebase Auth.
|
||||
await firebase.FirebaseAuth.instance.signOut();
|
||||
// Step 2: Sign out from local Firebase Auth via core service.
|
||||
await _firebaseAuthService.signOut();
|
||||
|
||||
// Step 3: Clear the client session store.
|
||||
ClientSessionStore.instance.clear();
|
||||
|
||||
@@ -67,7 +67,7 @@ class SettingsActions extends StatelessWidget {
|
||||
style: UiTypography.headline3m.textPrimary,
|
||||
),
|
||||
content: Text(
|
||||
'Are you sure you want to log out?',
|
||||
t.client_settings.profile.log_out_confirmation,
|
||||
style: UiTypography.body2r.textSecondary,
|
||||
),
|
||||
actions: <Widget>[
|
||||
@@ -77,7 +77,7 @@ class SettingsActions extends StatelessWidget {
|
||||
),
|
||||
UiButton.secondary(
|
||||
text: t.common.cancel,
|
||||
onPressed: () => Modular.to.pop(),
|
||||
onPressed: () => Modular.to.popSafe(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
|
||||
import '../../blocs/client_settings_bloc.dart';
|
||||
|
||||
@@ -78,7 +79,7 @@ class SettingsLogout extends StatelessWidget {
|
||||
// Cancel button
|
||||
UiButton.secondary(
|
||||
text: t.common.cancel,
|
||||
onPressed: () => Modular.to.pop(),
|
||||
onPressed: () => Modular.to.popSafe(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -14,8 +14,7 @@ dependencies:
|
||||
flutter_bloc: ^8.1.0
|
||||
flutter_modular: ^6.3.0
|
||||
equatable: ^2.0.5
|
||||
firebase_auth: ^6.1.2
|
||||
|
||||
|
||||
# Architecture Packages
|
||||
design_system:
|
||||
path: ../../../design_system
|
||||
|
||||
Reference in New Issue
Block a user