Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Deeplinking for the forgot password page #5362

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
19 changes: 19 additions & 0 deletions packages/smooth_app/lib/pages/navigator/app_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import 'package:smooth_app/pages/product/edit_product_page.dart';
import 'package:smooth_app/pages/product/product_loader_page.dart';
import 'package:smooth_app/pages/product/product_page/new_product_page.dart';
import 'package:smooth_app/pages/scan/carousel/scan_carousel_manager.dart';
import 'package:smooth_app/pages/scan/search_page.dart';
import 'package:smooth_app/pages/scan/search_product_helper.dart';
import 'package:smooth_app/pages/user_management/forgot_password_page.dart';
import 'package:smooth_app/pages/search/search_page.dart';
import 'package:smooth_app/pages/search/search_product_helper.dart';
import 'package:smooth_app/pages/user_management/sign_up_page.dart';
Expand Down Expand Up @@ -242,6 +245,16 @@ class _SmoothGoRouter {
}
},
),
GoRoute(
path: _InternalAppRoutes.FORGOT_PASSWORD_PAGE,
builder: (_, __) => const ForgotPasswordPage(),
),
GoRoute(
path: _InternalAppRoutes.EXTERNAL_PAGE,
builder: (BuildContext context, GoRouterState state) {
return ExternalPage(path: state.uri.queryParameters['path']!);
},
),
GoRoute(
path: _InternalAppRoutes.SIGNUP_PAGE,
builder: (_, __) => const SignUpPage(),
Expand Down Expand Up @@ -307,6 +320,8 @@ class _SmoothGoRouter {
return AppRoutes.GUIDE_NUTRISCORE_V2;
} else if (path == _ExternalRoutes.SIGNUP) {
return AppRoutes.SIGNUP;
} else if (path == _ExternalRoutes.FORGOT_PASSWORD) {
return AppRoutes.FORGOT_PASSWORD;
} else if (path != _InternalAppRoutes.HOME_PAGE) {
externalLink = true;
}
Expand Down Expand Up @@ -418,6 +433,7 @@ class _InternalAppRoutes {
static const String SEARCH_PAGE = '_search';
static const String EXTERNAL_PAGE = '_external';
static const String SIGNUP_PAGE = '_signup';
static const String FORGOT_PASSWORD_PAGE = '_forgot_password';

static const String _GUIDES = '_guides';
static const String GUIDE_NUTRISCORE_V2_PAGE = '_nutriscore-v2';
Expand All @@ -428,6 +444,7 @@ class _ExternalRoutes {
static const String PRODUCT_EDITION = '/cgi/product.pl';
static const String GUIDE_NUTRISCORE_V2 = '/nutriscore-v2';
static const String SIGNUP = '/signup';
static const String FORGOT_PASSWORD = '/forgot-password';
}

/// A list of internal routes to use with [AppNavigator]
Expand Down Expand Up @@ -474,6 +491,8 @@ class AppRoutes {
'/${_InternalAppRoutes._GUIDES}/${_InternalAppRoutes.GUIDE_NUTRISCORE_V2_PAGE}';

static String get SIGNUP => '/${_InternalAppRoutes.SIGNUP_PAGE}';
static String get FORGOT_PASSWORD =>
'/${_InternalAppRoutes.FORGOT_PASSWORD_PAGE}';

// Open an external link (where path is relative to the OFF website)
static String EXTERNAL(String path) =>
Expand Down
Loading