fix: email verify + consultant registration

This commit is contained in:
mso7nueh
2025-06-04 15:26:34 +03:00
parent cf6ad1eafe
commit cacfaff4cf
13 changed files with 87 additions and 67 deletions

View File

@@ -388,7 +388,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 24;
DEVELOPMENT_TEAM = VL68C36HYS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -538,7 +538,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 24;
DEVELOPMENT_TEAM = VL68C36HYS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -576,7 +576,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 23;
CURRENT_PROJECT_VERSION = 24;
DEVELOPMENT_TEAM = VL68C36HYS;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>23</string>
<string>24</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>

View File

@@ -100,9 +100,6 @@ class AppRouter {
GoRoute(
path: '/my-profile-screen',
name: 'myProfileScreen',
redirect: (context, state) async {
return null;
},
pageBuilder: (context, state) {
return const NoTransitionPage(child: ProfileScreen());
},
@@ -112,15 +109,21 @@ class AppRouter {
name: 'feedScreen',
pageBuilder: (context, state) => const NoTransitionPage(child: FeedScreen()),
redirect: (context, state) async {
final data = state.extra as Map<String, dynamic>?;
if (data?['needToInitializeWebSocket'] == false) {
return null;
try {
await sl<WsManager>().initialize();
} catch (e) {
rethrow;
}
await sl<WsManager>().initialize();
return null;
return '/feed-screen';
},
),
GoRoute(path: '/diary-screen', name: 'diaryScreen', pageBuilder: (context, state) => const NoTransitionPage(child: DiaryScreen())),
GoRoute(
path: '/diary-screen',
name: 'diaryScreen',
pageBuilder: (context, state) => const NoTransitionPage(
child: DiaryScreen(),
),
),
GoRoute(
path: ConsultationsScreen.path,
name: ConsultationsScreen.name,

View File

@@ -11,7 +11,7 @@ abstract class ConsultationRequestModel with _$ConsultationRequestModel {
@JsonKey(name: 'rating_place') int? ratingPlace,
@JsonKey(name: 'education_resource') required EducationModel educationModel,
@JsonKey(name: 'cert_photos') required List<CertPhotosModel> photos,
@JsonKey(name: 'canceled_moderation') required CanceledModerationModel canceledModeration,
@JsonKey(name: 'canceled_moderation') CanceledModerationModel? canceledModeration,
}) = _ConsultationRequestModel;
factory ConsultationRequestModel.fromJson(Map<String, dynamic> json) => _$ConsultationRequestModelFromJson(json);

View File

@@ -86,7 +86,13 @@ class RegisterConsultantCubit extends Cubit<RegisterConsultantState> {
}
updateConsultantProfileModel(ConsultantProfileModel consultant, [bool acceptOffer = false]) {
emit(RegisterConsultantState(consultant: consultant, acceptOffer: acceptOffer, loading: false));
emit(
state.copyWith(
consultant: consultant,
acceptOffer: acceptOffer,
loading: false,
),
);
}
registerConsultant() async {

View File

@@ -81,19 +81,19 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
),
),
),
if (state.requestModel?.canceledModeration.status == ModerationStatus.canceled)
if (state.requestModel?.educationModel.requestState == ModerationStatus.canceled)
InkWell(
onTap: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text(state.requestModel!.canceledModeration.title),
title: Text(state.requestModel!.canceledModeration!.title),
content: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
for (int i = 0; i < state.requestModel!.canceledModeration.additional!.length; i++) ...[
Text('• ${state.requestModel!.canceledModeration.additional![i]}'),
for (int i = 0; i < state.requestModel!.canceledModeration!.additional!.length; i++) ...[
Text('• ${state.requestModel!.canceledModeration!.additional![i]}'),
]
],
),
@@ -129,7 +129,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
),
Container(
height: 48,
width: state.requestModel?.canceledModeration.status == ModerationStatus.canceled
width: state.requestModel?.educationModel.requestState == ModerationStatus.canceled
? MediaQuery.of(context).size.width * 0.2
: MediaQuery.of(context).size.width * 0.8,
padding: const EdgeInsets.only(left: 4, right: 16),
@@ -143,7 +143,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
),
backgroundColor: isLoading
? Colors.grey
: state.requestModel?.canceledModeration.status == ModerationStatus.canceled
: state.requestModel?.educationModel.requestState == ModerationStatus.canceled
? const Color(0xFFEAF2FD)
: appTheme.blueA400,
onPressed: isLoading
@@ -272,7 +272,7 @@ class _StepperBecomeConsultantScreenState extends State<StepperBecomeConsultantS
},
label: isLoading
? const CircularProgressIndicator()
: state.requestModel?.canceledModeration.status == ModerationStatus.canceled
: state.requestModel?.educationModel.requestState == ModerationStatus.canceled
? Icon(
Icons.arrow_forward_ios_outlined,
color: appTheme.blueA400,

View File

@@ -1,3 +1,4 @@
import 'package:eatvio_app/features/consultant/become_consultant/models/consultation_request_model.dart';
import 'package:eatvio_app/features/my_finance/models/card_model.dart';
import 'package:eatvio_app/features/profile/models/badge_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -50,7 +51,7 @@ abstract class EducationModel with _$EducationModel {
@JsonKey(name: "fb_link") String? fbLink,
@JsonKey(name: "tg_link") String? tgLink,
@JsonKey(name: "personal_site_link") String? personalSiteLink,
@JsonKey(name: "request_state") String? requestState,
@JsonKey(name: "request_state") required ModerationStatus requestState,
}) = _EducationModel;
factory EducationModel.fromJson(Map<String, dynamic> json) => _$EducationModelFromJson(json);

View File

@@ -33,6 +33,7 @@ class ProfileCubit extends Cubit<ProfileState> {
);
} catch (e) {
emit(ProfileState.error(errorMessage: e.toString()));
rethrow;
}
}

View File

@@ -93,12 +93,15 @@ class _ProfileScreenState extends State<ProfileScreen> {
}
return widget.author == null || widget.author!.authorIsMe ? _myProfileScreen(state) : _profileScreen(state);
} else if (state is ProfileStateError) {
return DataErrorWidget(
onReload: () async {
widget.author == null || widget.author!.authorIsMe
? await profileCubit.getMyProfile()
: await profileCubit.getProfileBySlug(widget.author!.authorSlug);
},
return Scaffold(
appBar: AppBar(),
body: DataErrorWidget(
onReload: () async {
widget.author == null || widget.author!.authorIsMe
? await profileCubit.getMyProfile()
: await profileCubit.getProfileBySlug(widget.author!.authorSlug);
},
),
);
} else {
return Scaffold(
@@ -437,12 +440,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
padding: const EdgeInsets.only(bottom: 16),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
Text(
'Дипломы\nи сертификаты',
style: TextStyle(
color: Color(0xFF323F4B),
@@ -451,19 +454,19 @@ class _ProfileScreenState extends State<ProfileScreen> {
fontWeight: FontWeight.w600,
),
),
GestureDetector(
onTap: () {
GoRouter.of(context).pushNamed('stepperBecomeConsultantScreen', extra: state.profile.slug);
},
child: Text(
widget.author == null || widget.author!.authorIsMe ? 'Редактировать' : '',
style: const TextStyle(
color: Color(0xFF2F80ED),
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
// GestureDetector(
// onTap: () {
// GoRouter.of(context).pushNamed('stepperBecomeConsultantScreen', extra: state.profile.slug);
// },
// child: Text(
// widget.author == null || widget.author!.authorIsMe ? 'Редактировать' : '',
// style: const TextStyle(
// color: Color(0xFF2F80ED),
// fontSize: 16,
// fontWeight: FontWeight.w500,
// ),
// ),
// ),
],
),
),
@@ -538,12 +541,12 @@ class _ProfileScreenState extends State<ProfileScreen> {
padding: const EdgeInsets.only(bottom: 16),
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
Text(
'Образование',
style: TextStyle(
color: Color(0xFF323F4B),
@@ -551,19 +554,19 @@ class _ProfileScreenState extends State<ProfileScreen> {
fontWeight: FontWeight.w600,
),
),
GestureDetector(
onTap: () {
GoRouter.of(context).pushNamed('stepperBecomeConsultantScreen', extra: state.profile.slug);
},
child: Text(
widget.author == null || widget.author!.authorIsMe ? 'Редактировать' : '',
style: const TextStyle(
color: Color(0xFF2F80ED),
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
),
// GestureDetector(
// onTap: () {
// GoRouter.of(context).pushNamed('stepperBecomeConsultantScreen', extra: state.profile.slug);
// },
// child: Text(
// widget.author == null || widget.author!.authorIsMe ? 'Редактировать' : '',
// style: const TextStyle(
// color: Color(0xFF2F80ED),
// fontSize: 16,
// fontWeight: FontWeight.w500,
// ),
// ),
// ),
],
),
),

View File

@@ -58,7 +58,6 @@ class RegistrationCubit extends Cubit<RegistrationState> {
),
);
await TokenStorage.saveTokenInStorage(token);
AppRouter.navigatorKey.currentContext?.go('/feed-screen');
AppRouter.navigatorKey.currentContext?.pushNamed('verifyEmailScreen');
} catch (e) {
log(e.toString());

View File

@@ -17,6 +17,13 @@ class _VerifyEmailScreenState extends State<VerifyEmailScreen> {
final List<FocusNode> _focusNodes = List.generate(4, (_) => FocusNode());
final List<TextEditingController> _controllers = List.generate(4, (_) => TextEditingController());
String email = '';
late final GoRouter goRouter;
@override
void initState() {
super.initState();
goRouter = GoRouter.of(context);
}
@override
void dispose() {
@@ -48,7 +55,7 @@ class _VerifyEmailScreenState extends State<VerifyEmailScreen> {
});
} else if (state is VerifyEmailStateVerifySuccess) {
showSuccessToast('Почта успешно подтверждена');
GoRouter.of(context).pop();
goRouter.pushNamed('feedScreen');
} else if (state is VerifyEmailStateVerifyError) {
showErrorToast("Неверный код. Попробуйте снова.");
for (var controller in _controllers) {

View File

@@ -379,7 +379,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
);
} else {
if (state.consultationRequestModel!.canceledModeration.status == ModerationStatus.created) {
if (state.consultationRequestModel!.educationModel.requestState == ModerationStatus.created) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16) + const EdgeInsets.only(bottom: 8),
child: Ink(
@@ -391,7 +391,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
child: const Center(
child: Text(
'Данные на проверке...',
'Данные на проверке',
style: TextStyle(
color: Colors.black,
height: 1,
@@ -401,7 +401,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
),
);
} else if (state.consultationRequestModel!.canceledModeration.status == ModerationStatus.canceled) {
} else if (state.consultationRequestModel!.educationModel.requestState == ModerationStatus.canceled) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16) + const EdgeInsets.only(bottom: 8),
child: InkWell(

View File

@@ -1,6 +1,6 @@
name: eatvio_app
description: A new Flutter project.
version: 1.1.1+30
version: 1.1.2+32
publish_to: 'none'
environment: