From 15177295c5139c83951860a28e6fd5bf61489346 Mon Sep 17 00:00:00 2001 From: CowboyGH Date: Sat, 23 May 2026 15:07:15 +0700 Subject: [PATCH 1/3] fix(auth): close unverified email dialog before redirecting on sign-up - Add `didChangeDependencies` to capture `_rootNavigator` once - Cancel `_redirectTimer` in `dispose` to prevent navigation after widget is unmounted - Pop the feedback dialog via `_rootNavigator` before pushing verify-email route - Remove redundant `.then()` callback that could not fire (dialog was non-dismissible) --- .../auth/presentation/pages/sign_up_page.dart | 49 +++++++++++++++++-- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/lib/features/auth/presentation/pages/sign_up_page.dart b/lib/features/auth/presentation/pages/sign_up_page.dart index c1f7b451..5e045657 100644 --- a/lib/features/auth/presentation/pages/sign_up_page.dart +++ b/lib/features/auth/presentation/pages/sign_up_page.dart @@ -1,9 +1,12 @@ +import 'dart:async'; + import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import '../../../../core/constants/app_strings.dart'; +import '../../../../core/failures/feature/auth/auth_failure.dart'; import '../../../../core/router/router_paths.dart'; import '../../../../uikit/buttons/button_state.dart'; import '../../../../uikit/buttons/main_button.dart'; @@ -36,14 +39,48 @@ class _SignUpPageState extends State { bool _isAgree = false; + NavigatorState? _rootNavigator; + Timer? _redirectTimer; + + @override + void didChangeDependencies() { + super.didChangeDependencies(); + _rootNavigator ??= Navigator.of(context, rootNavigator: true); + } + @override void dispose() { + _redirectTimer?.cancel(); _nameController.dispose(); _emailController.dispose(); _passwordController.dispose(); super.dispose(); } + void _redirectUnverifiedUser({required String dialogMessage}) { + if (_redirectTimer != null) return; + + showAppFeedbackDialog( + context, + title: AppStrings.feedbackErrorTitle, + message: dialogMessage, + isBarrierDismissible: false, + ); + + _redirectTimer = Timer(const Duration(seconds: 2), () { + _redirectTimer = null; + if (!mounted) return; + _rootNavigator?.pop(); + context.push( + AppRoutePaths.verifyEmailPath, + extra: VerifyEmailRouteArgs( + email: _emailController.text.trim(), + resendOnOpen: true, + ), + ); + }); + } + void _submit() { final form = _formKey.currentState; if (form == null || !form.validate()) { @@ -82,11 +119,13 @@ class _SignUpPageState extends State { }, failed: (failure) { if (failure.message.isNotEmpty) { - showAppFeedbackDialog( - context, - title: AppStrings.feedbackErrorTitle, - message: failure.message, - ); + failure is EmailNotVerifiedFailure + ? _redirectUnverifiedUser(dialogMessage: failure.message) + : showAppFeedbackDialog( + context, + title: AppStrings.feedbackErrorTitle, + message: failure.message, + ); } }, ); From b1993a098790e5903dba28978508dfb476548a91 Mon Sep 17 00:00:00 2001 From: CowboyGH Date: Sat, 23 May 2026 15:08:24 +0700 Subject: [PATCH 2/3] chore(changelog): document sign-up unverified email redirect fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index beefc974..df25dc6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Profile frequency statistics now handle weekly payloads without `short_label`, keep dense period charts readable across `week`, `month`, `3 months`, `6 months`, and `year`, and clarify non-daily X-axis scales with short `нед.` / `мес.` labels. - Profile statistics dropdown menus now size to their content and render above surrounding UI instead of being clipped by the statistics card or overlapping incorrectly with lower screen sections. - Profile history and statistics copy now matches the latest profile mockups more closely, including `Активность` / `Завершено` labels, the separate `Средняя оценка:` summary label, and shortened cross-year period labels like `25-26`. +- Sign-up unverified-email redirect now correctly closes the feedback dialog before pushing the verify-email route, and cancels the redirect timer when the widget is disposed. ## [0.3.1] - 2026-03-25 From a7b2a720a07798d09f2537c344511368af111a9d Mon Sep 17 00:00:00 2001 From: CowboyGH Date: Sat, 23 May 2026 15:16:24 +0700 Subject: [PATCH 3/3] chore(changelog): move sign-up unverified email entry to Added section --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df25dc6b..a04b9318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Profile current phase section for the authenticated `/profile` tab, reusing the bootstrap profile phase snapshot plus aggregate statistics frequency summary to render the read-only phase block without a standalone phase slice. - Introduce personal parameters section for the authenticated `/profile` tab, including canonical `user-parameters` read/update flow, editable profile form card, weekly-goal save support, and selective workouts overview refresh when goal, equipment, or level changes regenerate the personal plan. - Add profile bottom section for the authenticated `/profile` tab, including logout and delete-profile confirmation actions plus direct links to the bundled legal documents. +- Sign-up page now redirects users with unverified emails to the verify-email screen: shows a brief non-dismissible feedback dialog, then automatically pushes the verify-email route after 2 seconds, matching the existing sign-in behavior. - Profile subscription section for the authenticated `/profile` tab, including active and empty subscription states, catalog entrypoints, profile-local subscription card hydration by `subscriptionId`, cancel-subscription confirmation flow and profile page refresh after cancellation. - Profile saved cards section for the authenticated `/profile` tab, including dedicated cards API/repository flow, saved-cards list rendering, add-card dialog with manual card form, default-card command, delete-card confirmation, and local refresh after successful actions. - Authenticated subscriptions catalog screen, including dedicated subscriptions route, catalog Cubit, card UI with normalized remote images, and a profile CTA for opening available subscription plans. @@ -60,7 +61,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Profile frequency statistics now handle weekly payloads without `short_label`, keep dense period charts readable across `week`, `month`, `3 months`, `6 months`, and `year`, and clarify non-daily X-axis scales with short `нед.` / `мес.` labels. - Profile statistics dropdown menus now size to their content and render above surrounding UI instead of being clipped by the statistics card or overlapping incorrectly with lower screen sections. - Profile history and statistics copy now matches the latest profile mockups more closely, including `Активность` / `Завершено` labels, the separate `Средняя оценка:` summary label, and shortened cross-year period labels like `25-26`. -- Sign-up unverified-email redirect now correctly closes the feedback dialog before pushing the verify-email route, and cancels the redirect timer when the widget is disposed. ## [0.3.1] - 2026-03-25