@@ -6,6 +6,7 @@ import 'package:flex_color_scheme/flex_color_scheme.dart';
6
6
import 'package:flutter/material.dart' ;
7
7
import 'package:ht_auth_repository/ht_auth_repository.dart' ;
8
8
import 'package:ht_data_repository/ht_data_repository.dart' ;
9
+ import 'package:ht_main/app/config/config.dart' as local_config;
9
10
import 'package:ht_shared/ht_shared.dart' ; // Import shared models and exceptions
10
11
11
12
part 'app_event.dart' ;
@@ -15,24 +16,23 @@ class AppBloc extends Bloc<AppEvent, AppState> {
15
16
AppBloc ({
16
17
required HtAuthRepository authenticationRepository,
17
18
required HtDataRepository <UserAppSettings > userAppSettingsRepository,
18
- required HtDataRepository <AppConfig > appConfigRepository, // Added
19
- }) : _authenticationRepository = authenticationRepository,
20
- _userAppSettingsRepository = userAppSettingsRepository,
21
- _appConfigRepository = appConfigRepository, // Added
22
- // Initialize with default state, load settings after user is known
23
- // Provide a default UserAppSettings instance
24
- super (
25
- // AppConfig will be null initially, fetched later
26
- const AppState (
27
- settings: UserAppSettings (id: 'default' ),
28
- selectedBottomNavigationIndex: 0 ,
29
- appConfig: null ,
30
- ),
31
- ) {
19
+ required HtDataRepository <AppConfig > appConfigRepository,
20
+ required local_config.AppEnvironment environment, // Added
21
+ }) : _authenticationRepository = authenticationRepository,
22
+ _userAppSettingsRepository = userAppSettingsRepository,
23
+ _appConfigRepository = appConfigRepository,
24
+ super (
25
+ AppState (
26
+ settings: const UserAppSettings (id: 'default' ),
27
+ selectedBottomNavigationIndex: 0 ,
28
+ appConfig: null ,
29
+ environment: environment, // Pass environment to AppState
30
+ ),
31
+ ) {
32
32
on < AppUserChanged > (_onAppUserChanged);
33
33
on < AppSettingsRefreshed > (_onAppSettingsRefreshed);
34
34
on < AppConfigFetchRequested > (_onAppConfigFetchRequested);
35
- on < AppUserAccountActionShown > (_onAppUserAccountActionShown); // Added
35
+ on < AppUserAccountActionShown > (_onAppUserAccountActionShown);
36
36
on < AppLogoutRequested > (_onLogoutRequested);
37
37
on < AppThemeModeChanged > (_onThemeModeChanged);
38
38
on < AppFlexSchemeChanged > (_onFlexSchemeChanged);
0 commit comments