From 242cb474ccb67c5d80570fea1bff0920ecc2667b Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Tue, 27 May 2025 16:50:36 +0300 Subject: [PATCH] feat(email): add alert for phone verify and email verify after registration --- lib/core/dio/phone_verify_error_interceptor.dart | 3 +++ lib/features/menu/presentation/pages/menu_screen.dart | 1 - .../bloc/registration_cubit/registration_cubit.dart | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/dio/phone_verify_error_interceptor.dart b/lib/core/dio/phone_verify_error_interceptor.dart index 5d764cff..ab6188bf 100644 --- a/lib/core/dio/phone_verify_error_interceptor.dart +++ b/lib/core/dio/phone_verify_error_interceptor.dart @@ -1,6 +1,7 @@ import 'package:dio/dio.dart'; import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/locator_service.dart'; +import 'package:eatvio_app/core/widgets/show_error_dialog.dart'; import 'package:eatvio_app/features/profile/repositories/profile_repository.dart'; import 'package:go_router/go_router.dart'; @@ -13,6 +14,8 @@ class PhoneVerifyErrorInterceptor extends Interceptor { if (data is Map && data['type'] == 'unverificated_phone') { final String phone = await sl().getMyPhone(); final String passKey = await sl().getPassKey(phone); + await showErrorDialog(AppRouter.navigatorKey.currentContext!, + title: 'Привяжите номер телефона', description: 'Для того, что бы выполнить это действие необходимо привязать номер телефона'); AppRouter.navigatorKey.currentContext?.pushNamed('verifyScreen', extra: passKey); return handler.reject( DioException( diff --git a/lib/features/menu/presentation/pages/menu_screen.dart b/lib/features/menu/presentation/pages/menu_screen.dart index 72532065..6ccb0973 100644 --- a/lib/features/menu/presentation/pages/menu_screen.dart +++ b/lib/features/menu/presentation/pages/menu_screen.dart @@ -58,7 +58,6 @@ class MenuScreen extends StatelessWidget { ), _divider(context), _tile(leading: ImageConstant.icnExit, title: 'Выход', onTap: _onTapLogout(context)), - _tile(leading: ImageConstant.icnExit, title: 'Verify email', onTap: () => GoRouter.of(context).pushNamed('verifyEmailScreen')), ], ), ), diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index 7b371f22..5956f579 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -59,6 +59,7 @@ class RegistrationCubit extends Cubit { ); await TokenStorage.saveTokenInStorage(token); AppRouter.navigatorKey.currentContext?.go('/feed-screen'); + AppRouter.navigatorKey.currentContext?.goNamed('verifyEmailScreen'); } catch (e) { log(e.toString()); }