Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

remove splash interface

appflowy6e8c3c821a16
diff --git a/frontend/app_flowy/lib/user/application/splash_bloc.dart b/frontend/app_flowy/lib/user/application/splash_bloc.dart
index 00dd66a635..de6d56e998 100644
--- a/frontend/app_flowy/lib/user/application/splash_bloc.dart
+++ b/frontend/app_flowy/lib/user/application/splash_bloc.dart
@@ -1,17 +1,25 @@
import 'package:app_flowy/user/domain/auth_state.dart';
-import 'package:app_flowy/user/domain/i_splash.dart';
+import 'package:flowy_sdk/dispatch/dispatch.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'splash_bloc.freezed.dart';
class SplashBloc extends Bloc<SplashEvent, SplashState> {
- final ISplashUser authImpl;
- SplashBloc(this.authImpl) : super(SplashState.initial()) {
+ SplashBloc() : super(SplashState.initial()) {
on<SplashEvent>((event, emit) async {
await event.map(
getUser: (val) async {
- final authState = await authImpl.currentUserProfile();
+ final result = await UserEventCheckUser().send();
+ final authState = result.fold(
+ (userProfile) {
+ return AuthState.authenticated(userProfile);
+ },
+ (error) {
+ return AuthState.unauthenticated(error);
+ },
+ );
+
emit(state.copyWith(auth: authState));
},
);
diff --git a/frontend/app_flowy/lib/user/domain/i_auth.dart b/frontend/app_flowy/lib/user/domain/i_auth.dart
deleted file mode 100644
index cff6b5d05f..0000000000
--- a/frontend/app_flowy/lib/user/domain/i_auth.dart
+++ /dev/null
@@ -1,10 +0,0 @@
-import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
-
-class NewUser {
- UserProfile profile;
- String workspaceId;
- NewUser({
- required this.profile,
- required this.workspaceId,
- });
-}
diff --git a/frontend/app_flowy/lib/user/domain/i_splash.dart b/frontend/app_flowy/lib/user/domain/i_splash.dart
deleted file mode 100644
index 385d9e8ae6..0000000000
--- a/frontend/app_flowy/lib/user/domain/i_splash.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
-import 'package:flowy_sdk/protobuf/flowy-folder-data-model/protobuf.dart';
-import 'package:flutter/widgets.dart';
-
-import 'auth_state.dart';
-
-abstract class ISplashUser {
- Future<AuthState> currentUserProfile();
-}
-
-abstract class ISplashUserWatch {
- void startWatching({
- void Function(AuthState)? authStateCallback,
- });
-
- Future<void> stopWatching();
-}
-
-abstract class ISplashRoute {
- void pushSignInScreen(BuildContext context);
- void pushSkipLoginScreen(BuildContext context);
-
- Future<void> pushWelcomeScreen(BuildContext context, UserProfile profile);
- void pushHomeScreen(BuildContext context, UserProfile profile, CurrentWorkspaceSetting workspaceSetting);
-}
diff --git a/frontend/app_flowy/lib/user/infrastructure/deps_resolver.dart b/frontend/app_flowy/lib/user/infrastructure/deps_resolver.dart
index aaaa9f81b1..be1e7461a0 100644
--- a/frontend/app_flowy/lib/user/infrastructure/deps_resolver.dart
+++ b/frontend/app_flowy/lib/user/infrastructure/deps_resolver.dart
@@ -1,10 +1,8 @@
import 'package:app_flowy/user/application/sign_in_bloc.dart';
import 'package:app_flowy/user/application/sign_up_bloc.dart';
import 'package:app_flowy/user/application/splash_bloc.dart';
-import 'package:app_flowy/user/domain/i_splash.dart';
import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
-import 'package:app_flowy/user/infrastructure/i_auth_impl.dart';
-import 'package:app_flowy/user/infrastructure/i_splash_impl.dart';
+import 'package:app_flowy/user/infrastructure/router.dart';
import 'package:app_flowy/workspace/application/edit_pannel/edit_pannel_bloc.dart';
import 'package:app_flowy/workspace/application/home/home_bloc.dart';
import 'package:app_flowy/workspace/application/home/home_listen_bloc.dart';
@@ -25,11 +23,10 @@ class UserDepsResolver {
getIt.registerFactory<SignInBloc>(() => SignInBloc(getIt<AuthRepository>()));
getIt.registerFactory<SignUpBloc>(() => SignUpBloc(getIt<AuthRepository>()));
- getIt.registerFactory<ISplashUser>(() => SplashUserImpl());
- getIt.registerFactory<ISplashRoute>(() => SplashRoute());
+ getIt.registerFactory<SplashRoute>(() => SplashRoute());
getIt.registerFactory<HomeBloc>(() => HomeBloc());
getIt.registerFactory<EditPannelBloc>(() => EditPannelBloc());
- getIt.registerFactory<SplashBloc>(() => SplashBloc(getIt<ISplashUser>()));
+ getIt.registerFactory<SplashBloc>(() => SplashBloc());
getIt.registerFactoryParam<HomeListenBloc, UserProfile, void>((user, _) => HomeListenBloc(
getIt<IUserListener>(param1: user),
diff --git a/frontend/app_flowy/lib/user/infrastructure/i_splash_impl.dart b/frontend/app_flowy/lib/user/infrastructure/i_splash_impl.dart
deleted file mode 100644
index 6064c3a489..0000000000
--- a/frontend/app_flowy/lib/user/infrastructure/i_splash_impl.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-import 'package:app_flowy/startup/startup.dart';
-import 'package:app_flowy/user/domain/auth_state.dart';
-import 'package:app_flowy/user/domain/i_splash.dart';
-import 'package:app_flowy/user/infrastructure/router.dart';
-import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
-import 'package:app_flowy/user/presentation/sign_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/workspace/infrastructure/repos/user_repo.dart';
-import 'package:app_flowy/workspace/presentation/home/home_screen.dart';
-import 'package:flowy_infra/time/duration.dart';
-import 'package:flowy_infra_ui/widget/route/animation.dart';
-import 'package:flowy_sdk/dispatch/dispatch.dart';
-import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
-import 'package:flowy_sdk/protobuf/flowy-folder-data-model/protobuf.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/widgets.dart';
-
-class SplashUserImpl implements ISplashUser {
- @override
- Future<AuthState> currentUserProfile() {
- final result = UserEventCheckUser().send();
- return result.then((result) {
- return result.fold(
- (userProfile) {
- return AuthState.authenticated(userProfile);
- },
- (error) {
- return AuthState.unauthenticated(error);
- },
- );
- });
- }
-}
-
-class SplashRoute implements ISplashRoute {
- @override
- Future<void> pushWelcomeScreen(BuildContext context, UserProfile user) async {
- final repo = UserRepo(user: user);
- final screen = WelcomeScreen(repo: repo);
- final workspaceId = await Navigator.of(context).push(
- PageRoutes.fade(
- () => screen,
- RouteDurations.slow.inMilliseconds * .001,
- ),
- );
-
- pushHomeScreen(context, repo.user, workspaceId);
- }
-
- @override
- void pushHomeScreen(BuildContext context, UserProfile userProfile, CurrentWorkspaceSetting workspaceSetting) {
- Navigator.push(
- context,
- PageRoutes.fade(() => HomeScreen(userProfile, workspaceSetting), RouteDurations.slow.inMilliseconds * .001),
- );
- }
-
- @override
- void pushSignInScreen(BuildContext context) {
- Navigator.push(
- context,
- PageRoutes.fade(() => SignInScreen(router: getIt<AuthRouter>()), RouteDurations.slow.inMilliseconds * .001),
- );
- }
-
- @override
- void pushSkipLoginScreen(BuildContext context) {
- Navigator.push(
- context,
- PageRoutes.fade(
- () => SkipLogInScreen(
- router: getIt<AuthRouter>(),
- authRepo: getIt<AuthRepository>(),
- ),
- RouteDurations.slow.inMilliseconds * .001),
- );
- }
-}
diff --git a/frontend/app_flowy/lib/user/infrastructure/router.dart b/frontend/app_flowy/lib/user/infrastructure/router.dart
index 1bbb9e78d1..2fb15420b5 100644
--- a/frontend/app_flowy/lib/user/infrastructure/router.dart
+++ b/frontend/app_flowy/lib/user/infrastructure/router.dart
@@ -1,6 +1,10 @@
import 'package:app_flowy/startup/startup.dart';
-import 'package:app_flowy/user/domain/i_splash.dart';
+import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
+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/skip_log_in_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:flowy_infra/time/duration.dart';
import 'package:flowy_infra_ui/widget/route/animation.dart';
@@ -9,13 +13,12 @@ import 'package:flowy_sdk/protobuf/flowy-folder-data-model/protobuf.dart';
import 'package:flutter/material.dart';
class AuthRouter {
- @override
void pushForgetPasswordScreen(BuildContext context) {
// TODO: implement showForgetPasswordScreen
}
void pushWelcomeScreen(BuildContext context, UserProfile userProfile) {
- getIt<ISplashRoute>().pushWelcomeScreen(context, userProfile);
+ getIt<SplashRoute>().pushWelcomeScreen(context, userProfile);
}
void pushSignUpScreen(BuildContext context) {
@@ -33,3 +36,44 @@ class AuthRouter {
);
}
}
+
+class SplashRoute {
+ Future<void> pushWelcomeScreen(BuildContext context, UserProfile user) async {
+ final repo = UserRepo(user: user);
+ final screen = WelcomeScreen(repo: repo);
+ final workspaceId = await Navigator.of(context).push(
+ PageRoutes.fade(
+ () => screen,
+ RouteDurations.slow.inMilliseconds * .001,
+ ),
+ );
+
+ pushHomeScreen(context, repo.user, workspaceId);
+ }
+
+ void pushHomeScreen(BuildContext context, UserProfile userProfile, CurrentWorkspaceSetting workspaceSetting) {
+ Navigator.push(
+ context,
+ PageRoutes.fade(() => HomeScreen(userProfile, workspaceSetting), RouteDurations.slow.inMilliseconds * .001),
+ );
+ }
+
+ void pushSignInScreen(BuildContext context) {
+ Navigator.push(
+ context,
+ PageRoutes.fade(() => SignInScreen(router: getIt<AuthRouter>()), RouteDurations.slow.inMilliseconds * .001),
+ );
+ }
+
+ void pushSkipLoginScreen(BuildContext context) {
+ Navigator.push(
+ context,
+ PageRoutes.fade(
+ () => SkipLogInScreen(
+ router: getIt<AuthRouter>(),
+ authRepo: getIt<AuthRepository>(),
+ ),
+ RouteDurations.slow.inMilliseconds * .001),
+ );
+ }
+}
diff --git a/frontend/app_flowy/lib/user/presentation/sign_up_screen.dart b/frontend/app_flowy/lib/user/presentation/sign_up_screen.dart
index c38cd48e36..00c47a6326 100644
--- a/frontend/app_flowy/lib/user/presentation/sign_up_screen.dart
+++ b/frontend/app_flowy/lib/user/presentation/sign_up_screen.dart
@@ -1,6 +1,6 @@
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/user/application/sign_up_bloc.dart';
-import 'package:app_flowy/user/domain/i_auth.dart';
+import 'package:app_flowy/user/infrastructure/router.dart';
import 'package:app_flowy/user/presentation/widgets/background.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/theme.dart';
@@ -17,7 +17,7 @@ import 'package:flowy_infra/image.dart';
import 'package:app_flowy/generated/locale_keys.g.dart';
class SignUpScreen extends StatelessWidget {
- final IAuthRouter router;
+ final AuthRouter router;
const SignUpScreen({Key? key, required this.router}) : super(key: key);
@override
diff --git a/frontend/app_flowy/lib/user/presentation/skip_log_in_screen.dart b/frontend/app_flowy/lib/user/presentation/skip_log_in_screen.dart
index 2f3dd8127b..cab4f4db38 100644
--- a/frontend/app_flowy/lib/user/presentation/skip_log_in_screen.dart
+++ b/frontend/app_flowy/lib/user/presentation/skip_log_in_screen.dart
@@ -1,4 +1,4 @@
-import 'package:app_flowy/user/infrastructure/i_auth_impl.dart';
+import 'package:app_flowy/user/infrastructure/router.dart';
import 'package:app_flowy/user/infrastructure/repos/auth_repo.dart';
import 'package:app_flowy/user/presentation/widgets/background.dart';
import 'package:app_flowy/workspace/domain/i_user.dart';
diff --git a/frontend/app_flowy/lib/user/presentation/splash_screen.dart b/frontend/app_flowy/lib/user/presentation/splash_screen.dart
index 9b43408935..aa66a58ffe 100644
--- a/frontend/app_flowy/lib/user/presentation/splash_screen.dart
+++ b/frontend/app_flowy/lib/user/presentation/splash_screen.dart
@@ -1,7 +1,7 @@
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/user/application/splash_bloc.dart';
import 'package:app_flowy/user/domain/auth_state.dart';
-import 'package:app_flowy/user/domain/i_splash.dart';
+import 'package:app_flowy/user/infrastructure/router.dart';
import 'package:flowy_log/flowy_log.dart';
import 'package:flowy_sdk/dispatch/dispatch.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/errors.pb.dart';
@@ -47,11 +47,11 @@ class SplashScreen extends StatelessWidget {
FolderEventReadCurWorkspace().send().then(
(result) {
return result.fold(
- (workspaceSetting) => getIt<ISplashRoute>().pushHomeScreen(context, userProfile, workspaceSetting),
+ (workspaceSetting) => getIt<SplashRoute>().pushHomeScreen(context, userProfile, workspaceSetting),
(error) async {
Log.error(error);
assert(error.code == ErrorCode.RecordNotFound.value);
- getIt<ISplashRoute>().pushWelcomeScreen(context, userProfile);
+ getIt<SplashRoute>().pushWelcomeScreen(context, userProfile);
},
);
},
@@ -59,8 +59,8 @@ class SplashScreen extends StatelessWidget {
}
void _handleUnauthenticated(BuildContext context, Unauthenticated result) {
- // getIt<ISplashRoute>().pushSignInScreen(context);
- getIt<ISplashRoute>().pushSkipLoginScreen(context);
+ // getIt<SplashRoute>().pushSignInScreen(context);
+ getIt<SplashRoute>().pushSkipLoginScreen(context);
}
}
diff --git a/frontend/app_flowy/macos/Flutter/GeneratedPluginRegistrant.swift b/frontend/app_flowy/macos/Flutter/GeneratedPluginRegistrant.swift
index da7d6b58e2..8d97942332 100644
--- a/frontend/app_flowy/macos/Flutter/GeneratedPluginRegistrant.swift
+++ b/frontend/app_flowy/macos/Flutter/GeneratedPluginRegistrant.swift
@@ -6,7 +6,6 @@ import FlutterMacOS
import Foundation
import connectivity_plus_macos
-import desktop_window
import device_info_plus_macos
import flowy_infra_ui
import flowy_sdk
@@ -18,7 +17,6 @@ import window_size
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
- DesktopWindowPlugin.register(with: registry.registrar(forPlugin: "DesktopWindowPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FlowyInfraUIPlugin.register(with: registry.registrar(forPlugin: "FlowyInfraUIPlugin"))
FlowySdkPlugin.register(with: registry.registrar(forPlugin: "FlowySdkPlugin"))
diff --git a/frontend/app_flowy/pubspec.lock b/frontend/app_flowy/pubspec.lock
index 394f0f66b1..e00e5ccb9f 100644
--- a/frontend/app_flowy/pubspec.lock
+++ b/frontend/app_flowy/pubspec.lock
@@ -260,13 +260,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.8"
- desktop_window:
- dependency: "direct main"
- description:
- name: desktop_window
- url: "https://pub.dartlang.org"
- source: hosted
- version: "0.4.0"
device_info_plus:
dependency: "direct main"
description:
diff --git a/frontend/app_flowy/pubspec.yaml b/frontend/app_flowy/pubspec.yaml
index 64836b38d3..206c60c5ba 100644
--- a/frontend/app_flowy/pubspec.yaml
+++ b/frontend/app_flowy/pubspec.yaml
@@ -58,7 +58,6 @@ dependencies:
url: git://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
- desktop_window: ^0.4.0
sized_context: ^1.0.0+1
styled_widget: "^0.3.1"
expandable: ^5.0.1