mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: Put User business logic in a service
This commit is contained in:
parent
289b3e31e7
commit
afab7f23c4
@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:dartz/dartz.dart';
|
import 'package:dartz/dartz.dart';
|
||||||
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
|
||||||
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
@ -10,65 +9,9 @@ import 'package:flowy_sdk/protobuf/dart-notify/protobuf.dart';
|
|||||||
import 'package:flowy_sdk/protobuf/flowy-folder/dart_notification.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-folder/dart_notification.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-user-data-model/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/errors.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
||||||
// import 'package:flowy_sdk/protobuf/flowy-user/errors.pb.dart' as user_error;
|
|
||||||
import 'package:flowy_sdk/protobuf/flowy-user/dart_notification.pb.dart' as user;
|
import 'package:flowy_sdk/protobuf/flowy-user/dart_notification.pb.dart' as user;
|
||||||
import 'package:flowy_sdk/rust_stream.dart';
|
import 'package:flowy_sdk/rust_stream.dart';
|
||||||
|
|
||||||
class UserRepo {
|
|
||||||
final UserProfile user;
|
|
||||||
UserRepo({
|
|
||||||
required this.user,
|
|
||||||
});
|
|
||||||
|
|
||||||
Future<Either<UserProfile, FlowyError>> fetchUserProfile({required String userId}) {
|
|
||||||
return UserEventGetUserProfile().send();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<Unit, FlowyError>> deleteWorkspace({required String workspaceId}) {
|
|
||||||
throw UnimplementedError();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<Unit, FlowyError>> signOut() {
|
|
||||||
return UserEventSignOut().send();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<Unit, FlowyError>> initUser() async {
|
|
||||||
return UserEventInitUser().send();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<List<Workspace>, FlowyError>> getWorkspaces() {
|
|
||||||
final request = WorkspaceId.create();
|
|
||||||
|
|
||||||
return FolderEventReadWorkspaces(request).send().then((result) {
|
|
||||||
return result.fold(
|
|
||||||
(workspaces) => left(workspaces.items),
|
|
||||||
(error) => right(error),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<Workspace, FlowyError>> openWorkspace(String workspaceId) {
|
|
||||||
final request = WorkspaceId.create()..value = workspaceId;
|
|
||||||
return FolderEventOpenWorkspace(request).send().then((result) {
|
|
||||||
return result.fold(
|
|
||||||
(workspace) => left(workspace),
|
|
||||||
(error) => right(error),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<Either<Workspace, FlowyError>> createWorkspace(String name, String desc) {
|
|
||||||
final request = CreateWorkspacePayload.create()
|
|
||||||
..name = name
|
|
||||||
..desc = desc;
|
|
||||||
return FolderEventCreateWorkspace(request).send().then((result) {
|
|
||||||
return result.fold(
|
|
||||||
(workspace) => left(workspace),
|
|
||||||
(error) => right(error),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef UserProfileUpdatedNotifierValue = Either<UserProfile, FlowyError>;
|
typedef UserProfileUpdatedNotifierValue = Either<UserProfile, FlowyError>;
|
||||||
typedef AuthNotifierValue = Either<Unit, FlowyError>;
|
typedef AuthNotifierValue = Either<Unit, FlowyError>;
|
57
frontend/app_flowy/lib/user/application/user_service.dart
Normal file
57
frontend/app_flowy/lib/user/application/user_service.dart
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'package:dartz/dartz.dart';
|
||||||
|
import 'package:flowy_sdk/dispatch/dispatch.dart';
|
||||||
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
||||||
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||||
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
||||||
|
|
||||||
|
class UserService {
|
||||||
|
Future<Either<UserProfile, FlowyError>> fetchUserProfile({required String userId}) {
|
||||||
|
return UserEventGetUserProfile().send();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Either<Unit, FlowyError>> deleteWorkspace({required String workspaceId}) {
|
||||||
|
throw UnimplementedError();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Either<Unit, FlowyError>> signOut() {
|
||||||
|
return UserEventSignOut().send();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Either<Unit, FlowyError>> initUser() async {
|
||||||
|
return UserEventInitUser().send();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Either<List<Workspace>, FlowyError>> getWorkspaces() {
|
||||||
|
final request = WorkspaceId.create();
|
||||||
|
|
||||||
|
return FolderEventReadWorkspaces(request).send().then((result) {
|
||||||
|
return result.fold(
|
||||||
|
(workspaces) => left(workspaces.items),
|
||||||
|
(error) => right(error),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Either<Workspace, FlowyError>> openWorkspace(String workspaceId) {
|
||||||
|
final request = WorkspaceId.create()..value = workspaceId;
|
||||||
|
return FolderEventOpenWorkspace(request).send().then((result) {
|
||||||
|
return result.fold(
|
||||||
|
(workspace) => left(workspace),
|
||||||
|
(error) => right(error),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Either<Workspace, FlowyError>> createWorkspace(String name, String desc) {
|
||||||
|
final request = CreateWorkspacePayload.create()
|
||||||
|
..name = name
|
||||||
|
..desc = desc;
|
||||||
|
return FolderEventCreateWorkspace(request).send().then((result) {
|
||||||
|
return result.fold(
|
||||||
|
(workspace) => left(workspace),
|
||||||
|
(error) => right(error),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@ import 'package:app_flowy/user/presentation/sign_in_screen.dart';
|
|||||||
import 'package:app_flowy/user/presentation/sign_up_screen.dart';
|
import 'package:app_flowy/user/presentation/sign_up_screen.dart';
|
||||||
import 'package:app_flowy/user/presentation/skip_log_in_screen.dart';
|
import 'package:app_flowy/user/presentation/skip_log_in_screen.dart';
|
||||||
import 'package:app_flowy/user/presentation/welcome_screen.dart';
|
import 'package:app_flowy/user/presentation/welcome_screen.dart';
|
||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
|
||||||
import 'package:app_flowy/workspace/presentation/home/home_screen.dart';
|
import 'package:app_flowy/workspace/presentation/home/home_screen.dart';
|
||||||
import 'package:flowy_infra/time/duration.dart';
|
import 'package:flowy_infra/time/duration.dart';
|
||||||
import 'package:flowy_infra_ui/widget/route/animation.dart';
|
import 'package:flowy_infra_ui/widget/route/animation.dart';
|
||||||
@ -38,9 +37,8 @@ class AuthRouter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SplashRoute {
|
class SplashRoute {
|
||||||
Future<void> pushWelcomeScreen(BuildContext context, UserProfile user) async {
|
Future<void> pushWelcomeScreen(BuildContext context, UserProfile userProfile) async {
|
||||||
final repo = UserRepo(user: user);
|
final screen = WelcomeScreen(userProfile: userProfile);
|
||||||
final screen = WelcomeScreen(repo: repo);
|
|
||||||
final workspaceId = await Navigator.of(context).push(
|
final workspaceId = await Navigator.of(context).push(
|
||||||
PageRoutes.fade(
|
PageRoutes.fade(
|
||||||
() => screen,
|
() => screen,
|
||||||
@ -48,7 +46,7 @@ class SplashRoute {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
pushHomeScreen(context, repo.user, workspaceId);
|
pushHomeScreen(context, userProfile, workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushHomeScreen(BuildContext context, UserProfile userProfile, CurrentWorkspaceSetting workspaceSetting) {
|
void pushHomeScreen(BuildContext context, UserProfile userProfile, CurrentWorkspaceSetting workspaceSetting) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
import 'package:app_flowy/user/application/user_listener.dart';
|
||||||
import 'package:app_flowy/user/infrastructure/router.dart';
|
import 'package:app_flowy/user/infrastructure/router.dart';
|
||||||
import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
|
import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
|
||||||
import 'package:app_flowy/user/presentation/widgets/background.dart';
|
import 'package:app_flowy/user/presentation/widgets/background.dart';
|
||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flowy_infra/size.dart';
|
import 'package:flowy_infra/size.dart';
|
||||||
import 'package:flowy_infra/theme.dart';
|
import 'package:flowy_infra/theme.dart';
|
||||||
|
@ -6,22 +6,22 @@ import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart';
|
|||||||
import 'package:flowy_infra_ui/style_widget/button.dart';
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
||||||
import 'package:flowy_infra_ui/widget/error_page.dart';
|
import 'package:flowy_infra_ui/widget/error_page.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
||||||
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
|
||||||
import 'package:app_flowy/generated/locale_keys.g.dart';
|
import 'package:app_flowy/generated/locale_keys.g.dart';
|
||||||
|
|
||||||
class WelcomeScreen extends StatelessWidget {
|
class WelcomeScreen extends StatelessWidget {
|
||||||
final UserRepo repo;
|
final UserProfile userProfile;
|
||||||
const WelcomeScreen({
|
const WelcomeScreen({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.repo,
|
required this.userProfile,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (_) => getIt<WelcomeBloc>(param1: repo.user)..add(const WelcomeEvent.initial()),
|
create: (_) => getIt<WelcomeBloc>(param1: userProfile)..add(const WelcomeEvent.initial()),
|
||||||
child: BlocBuilder<WelcomeBloc, WelcomeState>(
|
child: BlocBuilder<WelcomeBloc, WelcomeState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
import 'package:app_flowy/user/application/user_listener.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/errors.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
import 'package:app_flowy/user/application/user_listener.dart';
|
||||||
|
import 'package:app_flowy/user/application/user_service.dart';
|
||||||
import 'package:flowy_sdk/log.dart';
|
import 'package:flowy_sdk/log.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||||
@ -10,16 +11,17 @@ import 'package:dartz/dartz.dart';
|
|||||||
part 'menu_user_bloc.freezed.dart';
|
part 'menu_user_bloc.freezed.dart';
|
||||||
|
|
||||||
class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
|
class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
|
||||||
final UserRepo repo;
|
final UserService userService;
|
||||||
final UserListener listener;
|
final UserListener userListener;
|
||||||
|
final UserProfile userProfile;
|
||||||
|
|
||||||
MenuUserBloc(this.repo, this.listener) : super(MenuUserState.initial(repo.user)) {
|
MenuUserBloc(this.userProfile, this.userService, this.userListener) : super(MenuUserState.initial(userProfile)) {
|
||||||
on<MenuUserEvent>((event, emit) async {
|
on<MenuUserEvent>((event, emit) async {
|
||||||
await event.map(
|
await event.map(
|
||||||
initial: (_) async {
|
initial: (_) async {
|
||||||
listener.profileUpdatedNotifier.addPublishListener(_profileUpdated);
|
userListener.profileUpdatedNotifier.addPublishListener(_profileUpdated);
|
||||||
listener.workspaceUpdatedNotifier.addPublishListener(_workspacesUpdated);
|
userListener.workspaceUpdatedNotifier.addPublishListener(_workspacesUpdated);
|
||||||
listener.start();
|
userListener.start();
|
||||||
await _initUser();
|
await _initUser();
|
||||||
},
|
},
|
||||||
fetchWorkspaces: (_FetchWorkspaces value) async {},
|
fetchWorkspaces: (_FetchWorkspaces value) async {},
|
||||||
@ -29,12 +31,12 @@ class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() async {
|
Future<void> close() async {
|
||||||
await listener.stop();
|
await userListener.stop();
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initUser() async {
|
Future<void> _initUser() async {
|
||||||
final result = await repo.initUser();
|
final result = await userService.initUser();
|
||||||
result.fold((l) => null, (error) => Log.error(error));
|
result.fold((l) => null, (error) => Log.error(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
import 'package:app_flowy/user/application/user_listener.dart';
|
||||||
|
import 'package:app_flowy/user/application/user_service.dart';
|
||||||
import 'package:flowy_sdk/log.dart';
|
import 'package:flowy_sdk/log.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/workspace.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
|
||||||
@ -9,14 +10,14 @@ import 'package:dartz/dartz.dart';
|
|||||||
part 'welcome_bloc.freezed.dart';
|
part 'welcome_bloc.freezed.dart';
|
||||||
|
|
||||||
class WelcomeBloc extends Bloc<WelcomeEvent, WelcomeState> {
|
class WelcomeBloc extends Bloc<WelcomeEvent, WelcomeState> {
|
||||||
final UserRepo repo;
|
final UserService userService;
|
||||||
final UserListener listener;
|
final UserListener userListener;
|
||||||
WelcomeBloc({required this.repo, required this.listener}) : super(WelcomeState.initial()) {
|
WelcomeBloc({required this.userService, required this.userListener}) : super(WelcomeState.initial()) {
|
||||||
on<WelcomeEvent>(
|
on<WelcomeEvent>(
|
||||||
(event, emit) async {
|
(event, emit) async {
|
||||||
await event.map(initial: (e) async {
|
await event.map(initial: (e) async {
|
||||||
listener.workspaceUpdatedNotifier.addPublishListener(_workspacesUpdated);
|
userListener.workspaceUpdatedNotifier.addPublishListener(_workspacesUpdated);
|
||||||
listener.start();
|
userListener.start();
|
||||||
//
|
//
|
||||||
await _fetchWorkspaces(emit);
|
await _fetchWorkspaces(emit);
|
||||||
}, openWorkspace: (e) async {
|
}, openWorkspace: (e) async {
|
||||||
@ -35,12 +36,12 @@ class WelcomeBloc extends Bloc<WelcomeEvent, WelcomeState> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() async {
|
Future<void> close() async {
|
||||||
await listener.stop();
|
await userListener.stop();
|
||||||
super.close();
|
super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _fetchWorkspaces(Emitter<WelcomeState> emit) async {
|
Future<void> _fetchWorkspaces(Emitter<WelcomeState> emit) async {
|
||||||
final workspacesOrFailed = await repo.getWorkspaces();
|
final workspacesOrFailed = await userService.getWorkspaces();
|
||||||
emit(workspacesOrFailed.fold(
|
emit(workspacesOrFailed.fold(
|
||||||
(workspaces) => state.copyWith(workspaces: workspaces, successOrFailure: left(unit)),
|
(workspaces) => state.copyWith(workspaces: workspaces, successOrFailure: left(unit)),
|
||||||
(error) {
|
(error) {
|
||||||
@ -51,7 +52,7 @@ class WelcomeBloc extends Bloc<WelcomeEvent, WelcomeState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _openWorkspace(Workspace workspace, Emitter<WelcomeState> emit) async {
|
Future<void> _openWorkspace(Workspace workspace, Emitter<WelcomeState> emit) async {
|
||||||
final result = await repo.openWorkspace(workspace.id);
|
final result = await userService.openWorkspace(workspace.id);
|
||||||
emit(result.fold(
|
emit(result.fold(
|
||||||
(workspaces) => state.copyWith(successOrFailure: left(unit)),
|
(workspaces) => state.copyWith(successOrFailure: left(unit)),
|
||||||
(error) {
|
(error) {
|
||||||
@ -62,7 +63,7 @@ class WelcomeBloc extends Bloc<WelcomeEvent, WelcomeState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _createWorkspace(String name, String desc, Emitter<WelcomeState> emit) async {
|
Future<void> _createWorkspace(String name, String desc, Emitter<WelcomeState> emit) async {
|
||||||
final result = await repo.createWorkspace(name, desc);
|
final result = await userService.createWorkspace(name, desc);
|
||||||
emit(result.fold(
|
emit(result.fold(
|
||||||
(workspace) {
|
(workspace) {
|
||||||
return state.copyWith(successOrFailure: left(unit));
|
return state.copyWith(successOrFailure: left(unit));
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
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_bloc.dart';
|
||||||
import 'package:app_flowy/workspace/application/app/app_listener.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/app/app_service.dart';
|
||||||
@ -17,7 +19,6 @@ 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_listener.dart';
|
||||||
import 'package:app_flowy/workspace/application/workspace/workspace_service.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/domain/page_stack/page_stack.dart';
|
||||||
import 'package:app_flowy/workspace/infrastructure/repos/user_repo.dart';
|
|
||||||
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/app.pb.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-folder-data-model/view.pb.dart';
|
||||||
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
import 'package:flowy_sdk/protobuf/flowy-user-data-model/user_profile.pb.dart';
|
||||||
@ -38,8 +39,8 @@ class HomeDepsResolver {
|
|||||||
getIt.registerLazySingleton<HomeStackManager>(() => HomeStackManager());
|
getIt.registerLazySingleton<HomeStackManager>(() => HomeStackManager());
|
||||||
getIt.registerFactoryParam<WelcomeBloc, UserProfile, void>(
|
getIt.registerFactoryParam<WelcomeBloc, UserProfile, void>(
|
||||||
(user, _) => WelcomeBloc(
|
(user, _) => WelcomeBloc(
|
||||||
repo: UserRepo(user: user),
|
userService: UserService(),
|
||||||
listener: getIt<UserListener>(param1: user),
|
userListener: getIt<UserListener>(param1: user),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -71,7 +72,8 @@ class HomeDepsResolver {
|
|||||||
|
|
||||||
getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>(
|
getIt.registerFactoryParam<MenuUserBloc, UserProfile, void>(
|
||||||
(user, _) => MenuUserBloc(
|
(user, _) => MenuUserBloc(
|
||||||
UserRepo(user: user),
|
user,
|
||||||
|
UserService(),
|
||||||
getIt<UserListener>(param1: user),
|
getIt<UserListener>(param1: user),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user