2026-08-07 08:49:29 +08:00
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
|
|
import 'package:get_it/get_it.dart';
|
2026-05-25 12:58:29 +08:00
|
|
|
|
import '../data/datasources/report_remote_datasource.dart';
|
|
|
|
|
|
import '../data/datasources/report_remote_datasource_impl.dart';
|
|
|
|
|
|
import '../data/repositories/report_repository_impl.dart';
|
|
|
|
|
|
import '../domain/repositories/report_repository.dart';
|
|
|
|
|
|
import '../domain/usecases/submit_report_usecase.dart';
|
|
|
|
|
|
import '../presentation/cubit/report_cubit.dart';
|
2026-08-07 08:49:29 +08:00
|
|
|
|
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
|
|
|
|
|
|
import 'package:maibu_satabot_v2/core/storage/user_storage.dart';
|
2026-05-25 12:58:29 +08:00
|
|
|
|
|
|
|
|
|
|
/// 上报模块依赖注入
|
|
|
|
|
|
class ReportDependencyInjector {
|
|
|
|
|
|
/// 创建 ReportCubit 实例
|
|
|
|
|
|
static ReportCubit createReportCubit() {
|
2026-08-07 08:49:29 +08:00
|
|
|
|
final sl = GetIt.I;
|
|
|
|
|
|
|
2026-05-25 12:58:29 +08:00
|
|
|
|
// 创建数据源
|
2026-08-07 08:49:29 +08:00
|
|
|
|
final ReportRemoteDataSource remoteDataSource =
|
|
|
|
|
|
ReportRemoteDataSourceImpl();
|
2026-05-25 12:58:29 +08:00
|
|
|
|
|
|
|
|
|
|
// 创建仓储
|
|
|
|
|
|
final ReportRepository repository = ReportRepositoryImpl(
|
|
|
|
|
|
remoteDataSource: remoteDataSource,
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
// 创建用例
|
2026-08-07 08:49:29 +08:00
|
|
|
|
final SubmitReportUseCase submitReportUseCase = SubmitReportUseCase(
|
|
|
|
|
|
repository,
|
|
|
|
|
|
);
|
2026-05-25 12:58:29 +08:00
|
|
|
|
|
2026-08-07 08:49:29 +08:00
|
|
|
|
// 创建 Cubit(注入 Dio、AppUserCubit、UserStorage)
|
|
|
|
|
|
return ReportCubit(
|
|
|
|
|
|
submitReportUseCase: submitReportUseCase,
|
|
|
|
|
|
dio: sl<Dio>(),
|
|
|
|
|
|
appUserCubit: sl<AppUserCubit>(),
|
|
|
|
|
|
userStorage: sl<UserStorage>(),
|
|
|
|
|
|
);
|
2026-05-25 12:58:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|