2021-07-22 17:06:53 +08:00
|
|
|
import 'package:app_flowy/workspace/application/app/app_bloc.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/app/app_watch_bloc.dart';
|
2021-07-24 18:55:13 +08:00
|
|
|
import 'package:app_flowy/workspace/application/doc/doc_bloc.dart';
|
2021-07-22 17:06:53 +08:00
|
|
|
import 'package:app_flowy/workspace/application/menu/menu_bloc.dart';
|
2021-07-26 13:51:41 +08:00
|
|
|
import 'package:app_flowy/workspace/application/menu/menu_user_bloc.dart';
|
2021-07-22 17:06:53 +08:00
|
|
|
import 'package:app_flowy/workspace/application/menu/menu_watch.dart';
|
2021-07-24 14:05:49 +08:00
|
|
|
import 'package:app_flowy/workspace/application/view/doc_watch_bloc.dart';
|
2021-07-24 09:57:17 +08:00
|
|
|
import 'package:app_flowy/workspace/application/view/view_bloc.dart';
|
2021-07-28 13:41:39 +08:00
|
|
|
import 'package:app_flowy/workspace/application/view/view_list_bloc.dart';
|
2021-07-24 09:57:17 +08:00
|
|
|
import 'package:app_flowy/workspace/domain/i_doc.dart';
|
|
|
|
import 'package:app_flowy/workspace/domain/i_view.dart';
|
2021-07-22 17:06:53 +08:00
|
|
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
|
|
|
import 'package:app_flowy/workspace/infrastructure/i_app_impl.dart';
|
2021-07-24 09:57:17 +08:00
|
|
|
import 'package:app_flowy/workspace/infrastructure/i_doc_impl.dart';
|
2021-07-22 17:06:53 +08:00
|
|
|
import 'package:app_flowy/workspace/infrastructure/i_workspace_impl.dart';
|
|
|
|
import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';
|
2021-07-24 09:57:17 +08:00
|
|
|
import 'package:app_flowy/workspace/infrastructure/repos/doc_repo.dart';
|
|
|
|
import 'package:app_flowy/workspace/infrastructure/repos/view_repo.dart';
|
2021-07-22 17:06:53 +08:00
|
|
|
import 'package:app_flowy/workspace/infrastructure/repos/workspace_repo.dart';
|
2021-07-24 22:27:24 +08:00
|
|
|
import 'package:flowy_editor/flowy_editor.dart';
|
2021-09-04 16:53:58 +08:00
|
|
|
import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';
|
2021-07-28 13:41:39 +08:00
|
|
|
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
|
2021-07-21 15:43:05 +08:00
|
|
|
import 'package:get_it/get_it.dart';
|
|
|
|
|
2021-07-26 11:51:39 +08:00
|
|
|
import 'i_user_impl.dart';
|
2021-07-24 09:57:17 +08:00
|
|
|
import 'i_view_impl.dart';
|
|
|
|
|
2021-07-21 15:43:05 +08:00
|
|
|
class HomeDepsResolver {
|
|
|
|
static Future<void> resolve(GetIt getIt) async {
|
2021-07-22 14:06:58 +08:00
|
|
|
//
|
|
|
|
getIt.registerLazySingleton<HomePageStack>(() => HomePageStack());
|
|
|
|
|
2021-07-22 11:23:15 +08:00
|
|
|
//App
|
2021-07-21 22:41:44 +08:00
|
|
|
getIt.registerFactoryParam<IApp, String, void>(
|
2021-07-24 09:57:17 +08:00
|
|
|
(appId, _) => IAppImpl(repo: AppRepository(appId: appId)));
|
|
|
|
getIt.registerFactoryParam<IAppWatch, String, void>(
|
|
|
|
(appId, _) => IAppWatchImpl(repo: AppWatchRepository(appId: appId)));
|
2021-07-22 11:23:15 +08:00
|
|
|
|
|
|
|
//workspace
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<IWorkspace, UserProfile, String>(
|
2021-08-30 16:18:58 +08:00
|
|
|
(user, workspaceId) => IWorkspaceImpl(
|
|
|
|
repo: WorkspaceRepo(user: user, workspaceId: workspaceId)));
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<IWorkspaceWatch, UserProfile, String>(
|
2021-08-30 16:18:58 +08:00
|
|
|
(user, workspaceId) => IWorkspaceWatchImpl(
|
|
|
|
repo: WorkspaceWatchRepo(user: user, workspaceId: workspaceId)));
|
2021-07-24 09:57:17 +08:00
|
|
|
|
|
|
|
// View
|
2021-07-28 13:41:39 +08:00
|
|
|
getIt.registerFactoryParam<IView, View, void>(
|
|
|
|
(view, _) => IViewImpl(repo: ViewRepository(view: view)));
|
|
|
|
getIt.registerFactoryParam<IViewWatch, View, void>(
|
|
|
|
(view, _) => IViewWatchImpl(repo: ViewWatchRepository(view: view)));
|
2021-07-24 09:57:17 +08:00
|
|
|
|
|
|
|
// Doc
|
|
|
|
getIt.registerFactoryParam<IDoc, String, void>(
|
|
|
|
(docId, _) => IDocImpl(repo: DocRepository(docId: docId)));
|
2021-07-21 15:43:05 +08:00
|
|
|
|
2021-07-26 11:51:39 +08:00
|
|
|
// User
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<IUser, UserProfile, void>(
|
2021-07-26 11:51:39 +08:00
|
|
|
(user, _) => IUserImpl(repo: UserRepo(user: user)));
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<IUserWatch, UserProfile, void>(
|
2021-07-30 08:43:10 +08:00
|
|
|
(user, _) => IUserWatchImpl(repo: UserWatchRepo(user: user)));
|
2021-07-26 11:51:39 +08:00
|
|
|
|
2021-07-26 13:51:41 +08:00
|
|
|
//Menu Bloc
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<MenuBloc, UserProfile, String>(
|
2021-08-30 16:18:58 +08:00
|
|
|
(user, workspaceId) =>
|
|
|
|
MenuBloc(getIt<IWorkspace>(param1: user, param2: workspaceId)));
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<MenuWatchBloc, UserProfile, String>(
|
2021-08-30 16:18:58 +08:00
|
|
|
(user, workspaceId) => MenuWatchBloc(
|
|
|
|
getIt<IWorkspaceWatch>(param1: user, param2: workspaceId)));
|
2021-07-22 11:23:15 +08:00
|
|
|
|
2021-09-04 16:53:58 +08:00
|
|
|
getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>(
|
2021-07-26 13:51:41 +08:00
|
|
|
(user, _) => MenuUserBloc(getIt<IUser>(param1: user)));
|
|
|
|
|
|
|
|
//
|
2021-07-22 12:23:14 +08:00
|
|
|
getIt.registerFactoryParam<AppBloc, String, void>(
|
|
|
|
(appId, _) => AppBloc(getIt<IApp>(param1: appId)));
|
|
|
|
getIt.registerFactoryParam<AppWatchBloc, String, void>(
|
|
|
|
(appId, _) => AppWatchBloc(getIt<IAppWatch>(param1: appId)));
|
2021-07-24 09:57:17 +08:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<ViewBloc, String, void>(
|
|
|
|
(viewId, _) => ViewBloc(iViewImpl: getIt<IView>(param1: viewId)));
|
|
|
|
|
2021-07-24 14:05:49 +08:00
|
|
|
getIt.registerFactoryParam<DocWatchBloc, String, void>(
|
|
|
|
(docId, _) => DocWatchBloc(iDocImpl: getIt<IDoc>(param1: docId)));
|
|
|
|
|
2021-07-24 18:55:13 +08:00
|
|
|
getIt.registerFactoryParam<DocBloc, String, void>(
|
|
|
|
(docId, _) => DocBloc(getIt<IDoc>(param1: docId)));
|
|
|
|
|
2021-07-24 22:27:24 +08:00
|
|
|
// editor
|
|
|
|
getIt.registerFactoryParam<EditorPersistence, String, void>(
|
|
|
|
(docId, _) => EditorPersistenceImpl(repo: DocRepository(docId: docId)));
|
2021-07-28 13:41:39 +08:00
|
|
|
|
|
|
|
getIt.registerFactoryParam<ViewListBloc, List<View>, void>(
|
|
|
|
(views, _) => ViewListBloc(views: views));
|
|
|
|
|
2021-07-24 09:57:17 +08:00
|
|
|
// getIt.registerFactoryParam<ViewBloc, String, void>(
|
|
|
|
// (viewId, _) => ViewBloc(iViewImpl: getIt<IView>(param1: viewId)));
|
2021-07-21 15:43:05 +08:00
|
|
|
}
|
|
|
|
}
|