Skip to content

feat: Deeplinking for the forgot password page #5362

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

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/smooth_app/lib/pages/navigator/app_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ 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/search/search_page.dart';
import 'package:smooth_app/pages/search/search_product_helper.dart';
import 'package:smooth_app/pages/user_management/forgot_password_page.dart';
import 'package:smooth_app/pages/user_management/sign_up_page.dart';
import 'package:smooth_app/query/product_query.dart';

Expand Down Expand Up @@ -261,6 +262,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 @@ -338,6 +349,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 @@ -450,6 +463,7 @@ class _InternalAppRoutes {
static const String EXTERNAL_PAGE = '_external';
static const String EXTERNAL_WEBVIEW_PAGE = '_external_webview';
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 @@ -460,6 +474,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 @@ -510,6 +525,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 in the browser or custom tabs
static String EXTERNAL(String path) =>
Expand Down