@@ -44,7 +44,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
4444 ),
4545 ),
4646 selectedBottomNavigationIndex: 0 ,
47- appConfig : null ,
47+ remoteConfig : null ,
4848 environment: environment,
4949 ),
5050 ) {
@@ -141,7 +141,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
141141 // User is null (unauthenticated or logged out)
142142 emit (
143143 state.copyWith (
144- appConfig : null ,
144+ remoteConfig : null ,
145145 clearAppConfig: true ,
146146 status: AppStatus .unauthenticated,
147147 ),
@@ -398,10 +398,11 @@ class AppBloc extends Bloc<AppEvent, AppState> {
398398 );
399399 // If AppConfig was somehow present without a user, clear it.
400400 // And ensure status isn't stuck on configFetching if this event was dispatched erroneously.
401- if (state.appConfig != null || state.status == AppStatus .configFetching) {
401+ if (state.remoteConfig != null ||
402+ state.status == AppStatus .configFetching) {
402403 emit (
403404 state.copyWith (
404- appConfig : null ,
405+ remoteConfig : null ,
405406 clearAppConfig: true ,
406407 status: AppStatus .unauthenticated,
407408 ),
@@ -411,7 +412,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
411412 }
412413
413414 // Avoid refetching if already loaded for the current user session, unless explicitly trying to recover from a failed state.
414- if (state.appConfig != null &&
415+ if (state.remoteConfig != null &&
415416 state.status != AppStatus .configFetchFailed) {
416417 print (
417418 '[AppBloc] AppConfig already loaded for user ${state .user ?.id } and not in a failed state. Skipping fetch.' ,
@@ -425,7 +426,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
425426 emit (
426427 state.copyWith (
427428 status: AppStatus .configFetching,
428- appConfig : null ,
429+ remoteConfig : null ,
429430 clearAppConfig: true ,
430431 ),
431432 );
@@ -442,15 +443,17 @@ class AppBloc extends Bloc<AppEvent, AppState> {
442443 state.user! .appRole == AppUserRole .standardUser
443444 ? AppStatus .authenticated
444445 : AppStatus .anonymous;
445- emit (state.copyWith (appConfig: appConfig, status: newStatusBasedOnUser));
446+ emit (
447+ state.copyWith (remoteConfig: appConfig, status: newStatusBasedOnUser),
448+ );
446449 } on HtHttpException catch (e) {
447450 print (
448451 '[AppBloc] Failed to fetch AppConfig (HtHttpException) for user ${state .user ?.id }: ${e .runtimeType } - ${e .message }' ,
449452 );
450453 emit (
451454 state.copyWith (
452455 status: AppStatus .configFetchFailed,
453- appConfig : null ,
456+ remoteConfig : null ,
454457 clearAppConfig: true ,
455458 ),
456459 );
@@ -462,7 +465,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
462465 emit (
463466 state.copyWith (
464467 status: AppStatus .configFetchFailed,
465- appConfig : null ,
468+ remoteConfig : null ,
466469 clearAppConfig: true ,
467470 ),
468471 );
@@ -519,11 +522,11 @@ class AppBloc extends Bloc<AppEvent, AppState> {
519522 }
520523
521524 Future <void > _onAppOpened (AppOpened event, Emitter <AppState > emit) async {
522- if (state.appConfig == null ) {
525+ if (state.remoteConfig == null ) {
523526 return ;
524527 }
525528
526- final appStatus = state.appConfig ! .appStatus;
529+ final appStatus = state.remoteConfig ! .appStatus;
527530
528531 if (appStatus.isUnderMaintenance) {
529532 emit (state.copyWith (status: AppStatus .underMaintenance));
0 commit comments