mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: fix merge from main
This commit is contained in:
parent
89644e88da
commit
1a887979c4
@ -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),
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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),
|
||||
);
|
||||
|
@ -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(),
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user