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:
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
@@ -9,7 +8,9 @@ import 'package:staff_main/src/presentation/blocs/staff_main_state.dart';
|
||||
///
|
||||
/// Tracks the active bottom-bar tab index, profile completion status, and
|
||||
/// bottom bar visibility based on the current route.
|
||||
class StaffMainCubit extends Cubit<StaffMainState> implements Disposable {
|
||||
class StaffMainCubit extends Cubit<StaffMainState>
|
||||
with BlocErrorHandler<StaffMainState>
|
||||
implements Disposable {
|
||||
/// Creates a [StaffMainCubit].
|
||||
StaffMainCubit({
|
||||
required GetProfileCompletionUseCase getProfileCompletionUsecase,
|
||||
@@ -67,20 +68,21 @@ class StaffMainCubit extends Cubit<StaffMainState> implements Disposable {
|
||||
if (_isLoadingCompletion || isClosed) return;
|
||||
|
||||
_isLoadingCompletion = true;
|
||||
try {
|
||||
final bool isComplete = await _getProfileCompletionUsecase();
|
||||
if (!isClosed) {
|
||||
emit(state.copyWith(isProfileComplete: isComplete));
|
||||
}
|
||||
} catch (e) {
|
||||
// If there's an error, allow access to all features
|
||||
debugPrint('Error loading profile completion: $e');
|
||||
if (!isClosed) {
|
||||
emit(state.copyWith(isProfileComplete: true));
|
||||
}
|
||||
} finally {
|
||||
_isLoadingCompletion = false;
|
||||
}
|
||||
await handleError(
|
||||
emit: emit,
|
||||
action: () async {
|
||||
final bool isComplete = await _getProfileCompletionUsecase();
|
||||
if (!isClosed) {
|
||||
emit(state.copyWith(isProfileComplete: isComplete));
|
||||
}
|
||||
},
|
||||
onError: (String errorKey) {
|
||||
// If there's an error, allow access to all features
|
||||
_isLoadingCompletion = false;
|
||||
return state.copyWith(isProfileComplete: true);
|
||||
},
|
||||
);
|
||||
_isLoadingCompletion = false;
|
||||
}
|
||||
|
||||
/// Navigates to the tab at [index].
|
||||
|
||||
Reference in New Issue
Block a user