import 'package:app_flowy/workspace/application/app/app_bloc.dart'; import 'package:app_flowy/workspace/application/doc/doc_bloc.dart'; import 'package:app_flowy/workspace/application/doc/share_bloc.dart'; import 'package:app_flowy/workspace/application/menu/menu_bloc.dart'; import 'package:app_flowy/workspace/application/menu/menu_user_bloc.dart'; import 'package:app_flowy/workspace/application/trash/trash_bloc.dart'; import 'package:app_flowy/workspace/application/view/view_bloc.dart'; import 'package:app_flowy/workspace/application/workspace/welcome_bloc.dart'; import 'package:app_flowy/workspace/domain/i_doc.dart'; import 'package:app_flowy/workspace/domain/i_share.dart'; import 'package:app_flowy/workspace/domain/i_trash.dart'; import 'package:app_flowy/workspace/domain/i_view.dart'; import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart'; import 'package:app_flowy/workspace/infrastructure/i_app_impl.dart'; import 'package:app_flowy/workspace/infrastructure/i_doc_impl.dart'; import 'package:app_flowy/workspace/infrastructure/i_trash_impl.dart'; import 'package:app_flowy/workspace/infrastructure/i_workspace_impl.dart'; import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart'; import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart'; import 'package:app_flowy/workspace/infrastructure/repos/trash_repo.dart'; import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart'; import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart'; import 'package:flowy_sdk/protobuf/flowy-user-infra/protobuf.dart' show UserProfile; import 'package:flowy_sdk/protobuf/flowy-workspace-infra/app_create.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-workspace-infra/view_create.pb.dart'; import 'package:get_it/get_it.dart'; import 'i_share_impl.dart'; import 'i_user_impl.dart'; import 'i_view_impl.dart'; import 'repos/share_repo.dart'; class HomeDepsResolver { static Future resolve(GetIt getIt) async { // getIt.registerLazySingleton(() => HomeStackManager()); getIt.registerFactoryParam( (user, _) => WelcomeBloc( repo: UserRepo(user: user), listener: getIt(param1: user), ), ); //App getIt.registerFactoryParam((appId, _) => IAppImpl(repo: AppRepository(appId: appId))); getIt.registerFactoryParam( (appId, _) => IAppListenerhImpl(repo: AppListenerRepository(appId: appId))); //workspace getIt.registerFactoryParam( (user, workspaceId) => IWorkspaceImpl(repo: WorkspaceRepo(user: user, workspaceId: workspaceId))); getIt.registerFactoryParam((user, workspaceId) => IWorkspaceListenerImpl(repo: WorkspaceListenerRepo(user: user, workspaceId: workspaceId))); // View getIt.registerFactoryParam((view, _) => IViewImpl(repo: ViewRepository(view: view))); getIt.registerFactoryParam( (view, _) => IViewListenerImpl(repo: ViewListenerRepository(view: view))); getIt.registerFactoryParam( (view, _) => ViewBloc( viewManager: getIt(param1: view), listener: getIt(param1: view), ), ); // Doc getIt.registerFactoryParam((docId, _) => IDocImpl(repo: DocRepository(docId: docId))); // User getIt.registerFactoryParam((user, _) => IUserImpl(repo: UserRepo(user: user))); getIt.registerFactoryParam((user, _) => IUserListenerImpl(user: user)); //Menu Bloc getIt.registerFactoryParam( (user, workspaceId) => MenuBloc( workspaceManager: getIt(param1: user, param2: workspaceId), listener: getIt(param1: user, param2: workspaceId), ), ); getIt.registerFactoryParam( (user, _) => MenuUserBloc(getIt(param1: user), getIt(param1: user))); // App getIt.registerFactoryParam( (app, _) => AppBloc( app: app, appManager: getIt(param1: app.id), listener: getIt(param1: app.id), ), ); // Doc getIt.registerFactoryParam( (view, _) => DocBloc( view: view, docManager: getIt(param1: view.id), listener: getIt(param1: view), trasnManager: getIt(), ), ); // trash getIt.registerLazySingleton(() => TrashRepo()); getIt.registerLazySingleton(() => TrashListenerRepo()); getIt.registerFactory(() => ITrashImpl(repo: getIt())); getIt.registerFactory(() => ITrashListenerImpl(repo: getIt())); getIt.registerFactory(() => TrashBloc(trasnManager: getIt(), listener: getIt())); // share getIt.registerLazySingleton(() => ShareRepo()); getIt.registerFactory(() => IShareImpl(repo: getIt())); getIt.registerFactoryParam( (view, _) => DocShareBloc(view: view, shareManager: getIt())); } }