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.

fix: fix merge from main

Ian Su1a887979c499
diff --git a/frontend/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart b/frontend/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart
index e6cadcfe3a..0f30bb9d45 100644
--- a/frontend/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart
+++ b/frontend/app_flowy/lib/workspace/application/menu/menu_user_bloc.dart
@@ -34,6 +34,14 @@ class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
didReceiveUserProfile: (UserProfilePB newUserProfile) {
emit(state.copyWith(userProfile: newUserProfile));
},
+ updateUserName: (String name) {
+ _userService.updateUserProfile(name: name).then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
);
});
}
diff --git a/frontend/app_flowy/lib/workspace/application/settings/settings_dialog_bloc.dart b/frontend/app_flowy/lib/workspace/application/settings/settings_dialog_bloc.dart
index 1dd73638b2..3c40f767b1 100644
--- a/frontend/app_flowy/lib/workspace/application/settings/settings_dialog_bloc.dart
+++ b/frontend/app_flowy/lib/workspace/application/settings/settings_dialog_bloc.dart
@@ -10,7 +10,7 @@ part 'settings_dialog_bloc.freezed.dart';
class SettingsDialogBloc extends Bloc<SettingsDialogEvent, SettingsDialogState> {
final UserListener _userListener;
- final UserProfile userProfile;
+ final UserProfilePB userProfile;
SettingsDialogBloc(this.userProfile)
: _userListener = UserListener(userProfile: userProfile),
@@ -20,7 +20,7 @@ class SettingsDialogBloc extends Bloc<SettingsDialogEvent, SettingsDialogState>
initial: () async {
_userListener.start(onProfileUpdated: _profileUpdated);
},
- didReceiveUserProfile: (UserProfile newUserProfile) {
+ didReceiveUserProfile: (UserProfilePB newUserProfile) {
emit(state.copyWith(userProfile: newUserProfile));
},
setViewIndex: (int viewIndex) {
@@ -36,7 +36,7 @@ class SettingsDialogBloc extends Bloc<SettingsDialogEvent, SettingsDialogState>
super.close();
}
- void _profileUpdated(Either<UserProfile, FlowyError> userProfileOrFailed) {
+ void _profileUpdated(Either<UserProfilePB, FlowyError> userProfileOrFailed) {
userProfileOrFailed.fold(
(newUserProfile) => add(SettingsDialogEvent.didReceiveUserProfile(newUserProfile)),
(err) => Log.error(err),
@@ -47,19 +47,19 @@ class SettingsDialogBloc extends Bloc<SettingsDialogEvent, SettingsDialogState>
@freezed
class SettingsDialogEvent with _$SettingsDialogEvent {
const factory SettingsDialogEvent.initial() = _Initial;
- const factory SettingsDialogEvent.didReceiveUserProfile(UserProfile newUserProfile) = _DidReceiveUserProfile;
+ const factory SettingsDialogEvent.didReceiveUserProfile(UserProfilePB newUserProfile) = _DidReceiveUserProfile;
const factory SettingsDialogEvent.setViewIndex(int index) = _SetViewIndex;
}
@freezed
class SettingsDialogState with _$SettingsDialogState {
const factory SettingsDialogState({
- required UserProfile userProfile,
+ required UserProfilePB userProfile,
required Either<Unit, String> successOrFailure,
required int viewIndex,
}) = _SettingsDialogState;
- factory SettingsDialogState.initial(UserProfile userProfile) => SettingsDialogState(
+ factory SettingsDialogState.initial(UserProfilePB userProfile) => SettingsDialogState(
userProfile: userProfile,
successOrFailure: left(unit),
viewIndex: 0,
diff --git a/frontend/app_flowy/lib/workspace/application/user/settings_user_bloc.dart b/frontend/app_flowy/lib/workspace/application/user/settings_user_bloc.dart
index 5a4954c068..7435778471 100644
--- a/frontend/app_flowy/lib/workspace/application/user/settings_user_bloc.dart
+++ b/frontend/app_flowy/lib/workspace/application/user/settings_user_bloc.dart
@@ -12,7 +12,7 @@ part 'settings_user_bloc.freezed.dart';
class SettingsUserViewBloc extends Bloc<SettingsUserEvent, SettingsUserState> {
final UserService _userService;
final UserListener _userListener;
- final UserProfile userProfile;
+ final UserProfilePB userProfile;
SettingsUserViewBloc(this.userProfile)
: _userListener = UserListener(userProfile: userProfile),
@@ -24,7 +24,7 @@ class SettingsUserViewBloc extends Bloc<SettingsUserEvent, SettingsUserState> {
_userListener.start(onProfileUpdated: _profileUpdated);
await _initUser();
},
- didReceiveUserProfile: (UserProfile newUserProfile) {
+ didReceiveUserProfile: (UserProfilePB newUserProfile) {
emit(state.copyWith(userProfile: newUserProfile));
},
updateUserName: (String name) {
@@ -50,7 +50,7 @@ class SettingsUserViewBloc extends Bloc<SettingsUserEvent, SettingsUserState> {
result.fold((l) => null, (error) => Log.error(error));
}
- void _profileUpdated(Either<UserProfile, FlowyError> userProfileOrFailed) {
+ void _profileUpdated(Either<UserProfilePB, FlowyError> userProfileOrFailed) {
userProfileOrFailed.fold(
(newUserProfile) => add(SettingsUserEvent.didReceiveUserProfile(newUserProfile)),
(err) => Log.error(err),
@@ -62,17 +62,17 @@ class SettingsUserViewBloc extends Bloc<SettingsUserEvent, SettingsUserState> {
class SettingsUserEvent with _$SettingsUserEvent {
const factory SettingsUserEvent.initial() = _Initial;
const factory SettingsUserEvent.updateUserName(String name) = _UpdateUserName;
- const factory SettingsUserEvent.didReceiveUserProfile(UserProfile newUserProfile) = _DidReceiveUserProfile;
+ const factory SettingsUserEvent.didReceiveUserProfile(UserProfilePB newUserProfile) = _DidReceiveUserProfile;
}
@freezed
class SettingsUserState with _$SettingsUserState {
const factory SettingsUserState({
- required UserProfile userProfile,
+ required UserProfilePB userProfile,
required Either<Unit, String> successOrFailure,
}) = _SettingsUserState;
- factory SettingsUserState.initial(UserProfile userProfile) => SettingsUserState(
+ factory SettingsUserState.initial(UserProfilePB userProfile) => SettingsUserState(
userProfile: userProfile,
successOrFailure: left(unit),
);
diff --git a/frontend/app_flowy/lib/workspace/presentation/settings/settings_dialog.dart b/frontend/app_flowy/lib/workspace/presentation/settings/settings_dialog.dart
index ae4d3f5e52..eaf09d770f 100644
--- a/frontend/app_flowy/lib/workspace/presentation/settings/settings_dialog.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/settings/settings_dialog.dart
@@ -6,17 +6,17 @@ import 'package:app_flowy/workspace/presentation/settings/widgets/settings_langu
import 'package:app_flowy/workspace/presentation/settings/widgets/settings_user_view.dart';
import 'package:app_flowy/workspace/presentation/settings/widgets/settings_menu.dart';
import 'package:app_flowy/workspace/application/settings/settings_dialog_bloc.dart';
-import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:provider/provider.dart';
class SettingsDialog extends StatelessWidget {
- final UserProfile user;
+ final UserProfilePB user;
SettingsDialog(this.user, {Key? key}) : super(key: ValueKey(user.id));
- Widget getSettingsView(int index, UserProfile user) {
+ Widget getSettingsView(int index, UserProfilePB user) {
final List<Widget> settingsViews = [
const SettingsAppearanceView(),
const SettingsLanguageView(),
diff --git a/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart b/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart
index 6cc56ccf74..f8f094d1b0 100644
--- a/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart
+++ b/frontend/app_flowy/lib/workspace/presentation/settings/widgets/settings_user_view.dart
@@ -2,10 +2,10 @@ import 'package:app_flowy/startup/startup.dart';
import 'package:flutter/material.dart';
import 'package:app_flowy/workspace/application/user/settings_user_bloc.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:flowy_sdk/protobuf/flowy-user/protobuf.dart' show UserProfile;
+import 'package:flowy_sdk/protobuf/flowy-user/user_profile.pb.dart';
class SettingsUserView extends StatelessWidget {
- final UserProfile user;
+ final UserProfilePB user;
SettingsUserView(this.user, {Key? key}) : super(key: ValueKey(user.id));
@override