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.

feat: enable collab workspace features (#5012)

Lucas.Xu932a403b5dfd
diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/doc_collab_adapter.dart b/frontend/appflowy_flutter/lib/plugins/document/application/doc_collab_adapter.dart
index 656b0c9d85..598dfb3798 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/application/doc_collab_adapter.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/application/doc_collab_adapter.dart
@@ -174,7 +174,7 @@ class DocumentCollabAdapter {
cursorColor: cursorColor,
builder: (_, __, rect) {
return Positioned(
- top: rect.top - 10,
+ top: rect.top - 14,
left: selection.isCollapsed ? rect.right : rect.left,
child: ColoredBox(
color: color,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart
index 0d1e074573..c67a038302 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/document_collaborators.dart
@@ -48,10 +48,11 @@ class DocumentCollaborators extends StatelessWidget {
(c) => FlowyTooltip(
message: c.userName,
child: CircleAvatar(
- backgroundColor: c.selectionColor.tryToColor(),
+ backgroundColor: c.cursorColor.tryToColor(),
child: FlowyText(
c.userName.characters.firstOrNull ?? ' ',
fontSize: fontSize,
+ color: Colors.black,
),
),
),
diff --git a/frontend/appflowy_flutter/lib/shared/feature_flags.dart b/frontend/appflowy_flutter/lib/shared/feature_flags.dart
index b872a1cbed..e2a7b64ece 100644
--- a/frontend/appflowy_flutter/lib/shared/feature_flags.dart
+++ b/frontend/appflowy_flutter/lib/shared/feature_flags.dart
@@ -81,6 +81,16 @@ enum FeatureFlag {
}
bool get isOn {
+ // release this feature in version 0.5.4
+ if ([
+ FeatureFlag.collaborativeWorkspace,
+ FeatureFlag.membersSettings,
+ FeatureFlag.syncDatabase,
+ FeatureFlag.syncDocument,
+ ].contains(this)) {
+ return true;
+ }
+
if (_values.containsKey(this)) {
return _values[this]!;
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart
index 60b86bb9c5..8d0ecbf4b1 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/user/user_workspace_bloc.dart
@@ -31,9 +31,13 @@ class UserWorkspaceBloc extends Bloc<UserWorkspaceEvent, UserWorkspaceState> {
final isCollabWorkspaceOn =
userProfile.authenticator != AuthenticatorPB.Local &&
FeatureFlag.collaborativeWorkspace.isOn;
+ final currentWorkspace = result?.$1;
+ if (currentWorkspace != null && result?.$3 == true) {
+ await _userService.openWorkspace(currentWorkspace.workspaceId);
+ }
emit(
state.copyWith(
- currentWorkspace: result?.$1,
+ currentWorkspace: currentWorkspace,
workspaces: result?.$2 ?? [],
isCollabWorkspaceOn: isCollabWorkspaceOn,
actionResult: null,
@@ -250,8 +254,12 @@ class UserWorkspaceBloc extends Bloc<UserWorkspaceEvent, UserWorkspaceState> {
final UserProfilePB userProfile;
final UserBackendService _userService;
- Future<(UserWorkspacePB currentWorkspace, List<UserWorkspacePB> workspaces)?>
- _fetchWorkspaces() async {
+ Future<
+ (
+ UserWorkspacePB currentWorkspace,
+ List<UserWorkspacePB> workspaces,
+ bool shouldOpenWorkspace,
+ )?> _fetchWorkspaces() async {
try {
final lastOpenedWorkspaceId = await getIt<KeyValueStorage>().get(
KVKeys.lastOpenedWorkspaceId,
@@ -268,7 +276,11 @@ class UserWorkspaceBloc extends Bloc<UserWorkspaceEvent, UserWorkspaceState> {
currentWorkspaceInList = lastOpenedWorkspace;
}
}
- return (currentWorkspaceInList, workspaces);
+ return (
+ currentWorkspaceInList,
+ workspaces,
+ lastOpenedWorkspaceId != currentWorkspace.id
+ );
} catch (e) {
Log.error('fetch workspace error: $e');
return null;