Fix missing OrganizationBloc provider and add OrgApi to DI
This commit is contained in:
@@ -7,6 +7,7 @@ import 'repositories/http_auth_repository.dart';
|
|||||||
import 'repositories/http_file_repository.dart';
|
import 'repositories/http_file_repository.dart';
|
||||||
import 'services/auth_service.dart';
|
import 'services/auth_service.dart';
|
||||||
import 'services/file_service.dart';
|
import 'services/file_service.dart';
|
||||||
|
import 'services/org_api.dart';
|
||||||
import 'viewmodels/login_view_model.dart';
|
import 'viewmodels/login_view_model.dart';
|
||||||
import 'viewmodels/file_explorer_view_model.dart';
|
import 'viewmodels/file_explorer_view_model.dart';
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ void configureDependencies(SessionBloc sessionBloc) {
|
|||||||
// Register services
|
// Register services
|
||||||
getIt.registerSingleton<AuthService>(AuthService(getIt<AuthRepository>()));
|
getIt.registerSingleton<AuthService>(AuthService(getIt<AuthRepository>()));
|
||||||
getIt.registerSingleton<FileService>(FileService(getIt<ApiClient>()));
|
getIt.registerSingleton<FileService>(FileService(getIt<ApiClient>()));
|
||||||
|
getIt.registerSingleton<OrgApi>(OrgApi(getIt<ApiClient>()));
|
||||||
|
|
||||||
// Register viewmodels
|
// Register viewmodels
|
||||||
getIt.registerSingleton<LoginViewModel>(LoginViewModel(getIt<AuthService>()));
|
getIt.registerSingleton<LoginViewModel>(LoginViewModel(getIt<AuthService>()));
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import '../blocs/permission/permission_bloc.dart';
|
|||||||
import '../blocs/upload/upload_bloc.dart';
|
import '../blocs/upload/upload_bloc.dart';
|
||||||
import '../repositories/file_repository.dart';
|
import '../repositories/file_repository.dart';
|
||||||
import '../services/file_service.dart';
|
import '../services/file_service.dart';
|
||||||
|
import '../services/org_api.dart';
|
||||||
import '../theme/app_theme.dart';
|
import '../theme/app_theme.dart';
|
||||||
import '../theme/modern_glass_button.dart';
|
import '../theme/modern_glass_button.dart';
|
||||||
import 'login_form.dart' show LoginForm;
|
import 'login_form.dart' show LoginForm;
|
||||||
@@ -212,19 +213,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
|
|||||||
orgId = '';
|
orgId = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap FileExplorer with required BlocProviders
|
return FileExplorer(orgId: orgId);
|
||||||
return MultiBlocProvider(
|
|
||||||
providers: [
|
|
||||||
BlocProvider<FileBrowserBloc>(
|
|
||||||
create: (context) => FileBrowserBloc(getIt<FileService>()),
|
|
||||||
),
|
|
||||||
BlocProvider<PermissionBloc>(create: (context) => PermissionBloc()),
|
|
||||||
BlocProvider<UploadBloc>(
|
|
||||||
create: (context) => UploadBloc(getIt<FileRepository>()),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
child: FileExplorer(orgId: orgId),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildNavButton(String label, IconData icon, {bool isAvatar = false}) {
|
Widget _buildNavButton(String label, IconData icon, {bool isAvatar = false}) {
|
||||||
@@ -269,7 +258,14 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return BlocProvider(
|
||||||
|
create: (context) => OrganizationBloc(
|
||||||
|
PermissionBloc(),
|
||||||
|
FileBrowserBloc(getIt<FileService>()),
|
||||||
|
UploadBloc(getIt<FileRepository>()),
|
||||||
|
getIt<OrgApi>(),
|
||||||
|
),
|
||||||
|
child: Scaffold(
|
||||||
backgroundColor: AppTheme.primaryBackground,
|
backgroundColor: AppTheme.primaryBackground,
|
||||||
body: Stack(
|
body: Stack(
|
||||||
children: [
|
children: [
|
||||||
@@ -550,6 +546,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user