Merge dev into feature branch
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import '../../domain/repositories/staff_main_repository_interface.dart';
|
||||
import 'package:staff_main/src/domain/repositories/staff_main_repository_interface.dart';
|
||||
|
||||
/// V2 API implementation of [StaffMainRepositoryInterface].
|
||||
///
|
||||
|
||||
@@ -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