mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: enable collab workspace features (#5012)
* feat: enable collab workspace features * feat: change collaborator background color
This commit is contained in:
parent
53dbef25ab
commit
932a403b5d
@ -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,
|
||||
|
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -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]!;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user