2022-02-28 23:37:41 -05:00
|
|
|
import 'package:app_flowy/user/application/user_listener.dart';
|
|
|
|
import 'package:app_flowy/user/application/user_service.dart';
|
2022-03-08 15:25:56 +08:00
|
|
|
import 'package:app_flowy/workspace/application/app/prelude.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/doc/prelude.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/grid/prelude.dart';
|
2022-03-17 17:25:43 +08:00
|
|
|
import 'package:app_flowy/workspace/application/grid/row_listener.dart';
|
2022-03-08 15:25:56 +08:00
|
|
|
import 'package:app_flowy/workspace/application/trash/prelude.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/workspace/prelude.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/view/prelude.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/home/prelude.dart';
|
|
|
|
import 'package:app_flowy/workspace/application/menu/prelude.dart';
|
|
|
|
|
2022-03-01 16:05:45 +08:00
|
|
|
import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
|
2022-01-27 20:39:54 +08:00
|
|
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/app.pb.dart';
|
|
|
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
|
2022-03-09 09:31:06 +08:00
|
|
|
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart';
|
2022-01-31 09:49:05 +08:00
|
|
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
2021-07-21 15:43:05 +08:00
|
|
|
import 'package:get_it/get_it.dart';
|
2021-07-24 09:57:17 +08:00
|
|
|
|
2021-07-21 15:43:05 +08:00
|
|
|
class HomeDepsResolver {
|
|
|
|
static Future<void> resolve(GetIt getIt) async {
|
2022-01-31 09:49:05 +08:00
|
|
|
getIt.registerFactoryParam<UserListener, UserProfile, void>(
|
|
|
|
(user, _) => UserListener(user: user),
|
|
|
|
);
|
|
|
|
|
|
|
|
getIt.registerFactoryParam<HomeListenBloc, UserProfile, void>(
|
|
|
|
(user, _) => HomeListenBloc(getIt<UserListener>(param1: user)),
|
|
|
|
);
|
|
|
|
|
2021-07-22 14:06:58 +08:00
|
|
|
//
|
2021-10-11 13:15:41 +08:00
|
|
|
getIt.registerLazySingleton<HomeStackManager>(() => HomeStackManager());
|
2021-10-14 14:34:22 +08:00
|
|
|
getIt.registerFactoryParam<WelcomeBloc, UserProfile, void>(
|
|
|
|
(user, _) => WelcomeBloc(
|
2022-02-28 23:37:41 -05:00
|
|
|
userService: UserService(),
|
|
|
|
userListener: getIt<UserListener>(param1: user),
|
2021-10-14 14:34:22 +08:00
|
|
|
),
|
|
|
|
);
|
2021-07-22 14:06:58 +08:00
|
|
|
|
2021-07-22 11:23:15 +08:00
|
|
|
//workspace
|
2022-02-28 22:38:11 -05:00
|
|
|
getIt.registerFactoryParam<WorkspaceListener, UserProfile, String>((user, workspaceId) =>
|
|
|
|
WorkspaceListener(service: WorkspaceListenerService(user: user, workspaceId: workspaceId)));
|
2021-07-24 09:57:17 +08:00
|
|
|
|
|
|
|
// View
|
2022-01-31 09:49:05 +08:00
|
|
|
getIt.registerFactoryParam<ViewListener, View, void>(
|
|
|
|
(view, _) => ViewListener(view: view),
|
|
|
|
);
|
|
|
|
|
2021-10-14 14:34:22 +08:00
|
|
|
getIt.registerFactoryParam<ViewBloc, View, void>(
|
|
|
|
(view, _) => ViewBloc(
|
2022-03-01 21:09:52 +08:00
|
|
|
view: view,
|
2022-02-28 23:06:36 -05:00
|
|
|
service: ViewService(),
|
2022-01-31 09:49:05 +08:00
|
|
|
listener: getIt<ViewListener>(param1: view),
|
2021-10-14 14:34:22 +08:00
|
|
|
),
|
|
|
|
);
|
2021-07-24 09:57:17 +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-10-18 22:08:35 +08:00
|
|
|
(user, workspaceId) => MenuBloc(
|
2022-02-28 22:38:11 -05:00
|
|
|
workspaceId: workspaceId,
|
|
|
|
service: WorkspaceService(),
|
2022-01-31 08:34:52 +08:00
|
|
|
listener: getIt<WorkspaceListener>(param1: user, param2: workspaceId),
|
2021-10-18 22:08:35 +08:00
|
|
|
),
|
|
|
|
);
|
2021-07-22 11:23:15 +08:00
|
|
|
|
2021-10-10 15:58:57 +08:00
|
|
|
getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>(
|
2022-01-31 09:49:05 +08:00
|
|
|
(user, _) => MenuUserBloc(
|
2022-02-28 23:37:41 -05:00
|
|
|
user,
|
|
|
|
UserService(),
|
2022-01-31 09:49:05 +08:00
|
|
|
getIt<UserListener>(param1: user),
|
|
|
|
),
|
|
|
|
);
|
2021-07-26 13:51:41 +08:00
|
|
|
|
2021-10-14 14:34:22 +08:00
|
|
|
// App
|
2021-10-30 17:19:50 +08:00
|
|
|
getIt.registerFactoryParam<AppBloc, App, void>(
|
|
|
|
(app, _) => AppBloc(
|
|
|
|
app: app,
|
2022-02-28 21:42:46 -05:00
|
|
|
service: AppService(),
|
2022-01-31 09:49:05 +08:00
|
|
|
listener: AppListener(appId: app.id),
|
2021-10-14 18:11:59 +08:00
|
|
|
),
|
|
|
|
);
|
2021-07-24 09:57:17 +08:00
|
|
|
|
2021-10-14 14:34:22 +08:00
|
|
|
// Doc
|
2022-02-23 22:17:47 +08:00
|
|
|
getIt.registerFactoryParam<DocumentBloc, View, void>(
|
|
|
|
(view, _) => DocumentBloc(
|
2021-10-31 19:48:20 +08:00
|
|
|
view: view,
|
2022-02-28 21:02:46 -05:00
|
|
|
service: DocumentService(),
|
2022-01-31 09:49:05 +08:00
|
|
|
listener: getIt<ViewListener>(param1: view),
|
2022-02-28 21:17:08 -05:00
|
|
|
trashService: getIt<TrashService>(),
|
2021-10-31 17:24:55 +08:00
|
|
|
),
|
|
|
|
);
|
2021-07-24 18:55:13 +08:00
|
|
|
|
2022-03-06 11:28:24 +08:00
|
|
|
// Grid
|
|
|
|
getIt.registerFactoryParam<GridBloc, View, void>(
|
2022-03-18 17:14:46 +08:00
|
|
|
(view, _) => GridBloc(view: view, service: GridService()),
|
2022-03-06 11:28:24 +08:00
|
|
|
);
|
|
|
|
|
2022-03-08 15:25:56 +08:00
|
|
|
getIt.registerFactoryParam<RowBloc, GridRowData, void>(
|
|
|
|
(data, _) => RowBloc(
|
2022-03-18 17:14:46 +08:00
|
|
|
rowService: RowService(data),
|
|
|
|
listener: RowListener(rowId: data.rowId),
|
2022-03-08 15:25:56 +08:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-03-09 09:31:06 +08:00
|
|
|
getIt.registerFactoryParam<ColumnBloc, List<Field>, void>(
|
|
|
|
(data, _) => ColumnBloc(
|
|
|
|
data: GridColumnData(fields: data),
|
|
|
|
service: ColumnService(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-03-18 17:14:46 +08:00
|
|
|
getIt.registerFactoryParam<TextCellBloc, GridCellData, void>(
|
2022-03-16 16:10:35 +08:00
|
|
|
(context, _) => TextCellBloc(
|
|
|
|
service: CellService(context),
|
2022-03-09 16:11:24 +08:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-03-18 17:14:46 +08:00
|
|
|
getIt.registerFactoryParam<SelectionCellBloc, GridCellData, void>(
|
2022-03-16 16:10:35 +08:00
|
|
|
(context, _) => SelectionCellBloc(
|
|
|
|
service: CellService(context),
|
2022-03-09 16:11:24 +08:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-03-18 17:14:46 +08:00
|
|
|
getIt.registerFactoryParam<NumberCellBloc, GridCellData, void>(
|
2022-03-16 16:10:35 +08:00
|
|
|
(context, _) => NumberCellBloc(
|
|
|
|
service: CellService(context),
|
2022-03-09 16:11:24 +08:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-03-18 17:14:46 +08:00
|
|
|
getIt.registerFactoryParam<DateCellBloc, GridCellData, void>(
|
2022-03-16 16:10:35 +08:00
|
|
|
(context, _) => DateCellBloc(
|
|
|
|
service: CellService(context),
|
2022-03-09 16:11:24 +08:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2022-03-18 17:14:46 +08:00
|
|
|
getIt.registerFactoryParam<CheckboxCellBloc, GridCellData, void>(
|
2022-03-16 16:10:35 +08:00
|
|
|
(context, _) => CheckboxCellBloc(
|
|
|
|
service: CellService(context),
|
2022-03-09 16:11:24 +08:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2021-10-14 14:34:22 +08:00
|
|
|
// trash
|
2022-02-28 21:17:08 -05:00
|
|
|
getIt.registerLazySingleton<TrashService>(() => TrashService());
|
2022-01-31 09:49:05 +08:00
|
|
|
getIt.registerLazySingleton<TrashListener>(() => TrashListener());
|
|
|
|
getIt.registerFactory<TrashBloc>(
|
|
|
|
() => TrashBloc(
|
2022-02-28 21:17:08 -05:00
|
|
|
service: getIt<TrashService>(),
|
2022-01-31 09:49:05 +08:00
|
|
|
listener: getIt<TrashListener>(),
|
|
|
|
),
|
|
|
|
);
|
2021-11-10 14:46:59 +08:00
|
|
|
|
|
|
|
// share
|
2022-02-28 23:45:17 -05:00
|
|
|
getIt.registerLazySingleton<ShareService>(() => ShareService());
|
2021-11-10 14:46:59 +08:00
|
|
|
getIt.registerFactoryParam<DocShareBloc, View, void>(
|
2022-02-28 23:45:17 -05:00
|
|
|
(view, _) => DocShareBloc(view: view, service: getIt<ShareService>()));
|
2021-07-21 15:43:05 +08:00
|
|
|
}
|
|
|
|
}
|