|
@@ -1,24 +1,29 @@
|
|
|
+import 'package:app_flowy/user/application/user_listener.dart';
|
|
|
+import 'package:app_flowy/user/application/user_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/app/app_bloc.dart';
|
|
|
+import 'package:app_flowy/workspace/application/app/app_listener.dart';
|
|
|
+import 'package:app_flowy/workspace/application/app/app_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/doc/doc_bloc.dart';
|
|
|
+import 'package:app_flowy/workspace/application/doc/doc_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/doc/share_bloc.dart';
|
|
|
+import 'package:app_flowy/workspace/application/doc/share_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/home/home_listen_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/trash/trash_listener.dart';
|
|
|
+import 'package:app_flowy/workspace/application/trash/trash_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/view/view_bloc.dart';
|
|
|
+import 'package:app_flowy/workspace/application/view/view_listener.dart';
|
|
|
+import 'package:app_flowy/workspace/application/view/view_service.dart';
|
|
|
import 'package:app_flowy/workspace/application/workspace/welcome_bloc.dart';
|
|
|
+import 'package:app_flowy/workspace/application/workspace/workspace_listener.dart';
|
|
|
+import 'package:app_flowy/workspace/application/workspace/workspace_service.dart';
|
|
|
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
|
|
|
-import 'package:app_flowy/workspace/infrastructure/repos/app_repo.dart';
|
|
|
-import 'package:app_flowy/workspace/infrastructure/repos/document_repo.dart';
|
|
|
-import 'package:app_flowy/workspace/infrastructure/repos/trash_repo.dart';
|
|
|
-import 'package:app_flowy/workspace/infrastructure/repos/user_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-folder-data-model/app.pb.dart';
|
|
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
|
|
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
|
|
import 'package:get_it/get_it.dart';
|
|
|
-import 'repos/share_repo.dart';
|
|
|
|
|
|
class HomeDepsResolver {
|
|
|
static Future<void> resolve(GetIt getIt) async {
|
|
@@ -34,14 +39,14 @@ class HomeDepsResolver {
|
|
|
getIt.registerLazySingleton<HomeStackManager>(() => HomeStackManager());
|
|
|
getIt.registerFactoryParam<WelcomeBloc, UserProfile, void>(
|
|
|
(user, _) => WelcomeBloc(
|
|
|
- repo: UserRepo(user: user),
|
|
|
- listener: getIt<UserListener>(param1: user),
|
|
|
+ userService: UserService(),
|
|
|
+ userListener: getIt<UserListener>(param1: user),
|
|
|
),
|
|
|
);
|
|
|
|
|
|
//workspace
|
|
|
- getIt.registerFactoryParam<WorkspaceListener, UserProfile, String>(
|
|
|
- (user, workspaceId) => WorkspaceListener(repo: WorkspaceListenerRepo(user: user, workspaceId: workspaceId)));
|
|
|
+ getIt.registerFactoryParam<WorkspaceListener, UserProfile, String>((user, workspaceId) =>
|
|
|
+ WorkspaceListener(service: WorkspaceListenerService(user: user, workspaceId: workspaceId)));
|
|
|
|
|
|
// View
|
|
|
getIt.registerFactoryParam<ViewListener, View, void>(
|
|
@@ -50,7 +55,8 @@ class HomeDepsResolver {
|
|
|
|
|
|
getIt.registerFactoryParam<ViewBloc, View, void>(
|
|
|
(view, _) => ViewBloc(
|
|
|
- repo: ViewRepository(view: view),
|
|
|
+ view: view,
|
|
|
+ service: ViewService(),
|
|
|
listener: getIt<ViewListener>(param1: view),
|
|
|
),
|
|
|
);
|
|
@@ -58,14 +64,16 @@ class HomeDepsResolver {
|
|
|
//Menu Bloc
|
|
|
getIt.registerFactoryParam<MenuBloc, UserProfile, String>(
|
|
|
(user, workspaceId) => MenuBloc(
|
|
|
- repo: WorkspaceRepo(user: user, workspaceId: workspaceId),
|
|
|
+ workspaceId: workspaceId,
|
|
|
+ service: WorkspaceService(),
|
|
|
listener: getIt<WorkspaceListener>(param1: user, param2: workspaceId),
|
|
|
),
|
|
|
);
|
|
|
|
|
|
getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>(
|
|
|
(user, _) => MenuUserBloc(
|
|
|
- UserRepo(user: user),
|
|
|
+ user,
|
|
|
+ UserService(),
|
|
|
getIt<UserListener>(param1: user),
|
|
|
),
|
|
|
);
|
|
@@ -74,7 +82,7 @@ class HomeDepsResolver {
|
|
|
getIt.registerFactoryParam<AppBloc, App, void>(
|
|
|
(app, _) => AppBloc(
|
|
|
app: app,
|
|
|
- repo: AppRepository(appId: app.id),
|
|
|
+ service: AppService(),
|
|
|
listener: AppListener(appId: app.id),
|
|
|
),
|
|
|
);
|
|
@@ -83,25 +91,25 @@ class HomeDepsResolver {
|
|
|
getIt.registerFactoryParam<DocumentBloc, View, void>(
|
|
|
(view, _) => DocumentBloc(
|
|
|
view: view,
|
|
|
- repo: DocumentRepository(docId: view.id),
|
|
|
+ service: DocumentService(),
|
|
|
listener: getIt<ViewListener>(param1: view),
|
|
|
- trashRepo: getIt<TrashRepo>(),
|
|
|
+ trashService: getIt<TrashService>(),
|
|
|
),
|
|
|
);
|
|
|
|
|
|
// trash
|
|
|
- getIt.registerLazySingleton<TrashRepo>(() => TrashRepo());
|
|
|
+ getIt.registerLazySingleton<TrashService>(() => TrashService());
|
|
|
getIt.registerLazySingleton<TrashListener>(() => TrashListener());
|
|
|
getIt.registerFactory<TrashBloc>(
|
|
|
() => TrashBloc(
|
|
|
- repo: getIt<TrashRepo>(),
|
|
|
+ service: getIt<TrashService>(),
|
|
|
listener: getIt<TrashListener>(),
|
|
|
),
|
|
|
);
|
|
|
|
|
|
// share
|
|
|
- getIt.registerLazySingleton<ShareRepo>(() => ShareRepo());
|
|
|
+ getIt.registerLazySingleton<ShareService>(() => ShareService());
|
|
|
getIt.registerFactoryParam<DocShareBloc, View, void>(
|
|
|
- (view, _) => DocShareBloc(view: view, repo: getIt<ShareRepo>()));
|
|
|
+ (view, _) => DocShareBloc(view: view, service: getIt<ShareService>()));
|
|
|
}
|
|
|
}
|