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: added deeplinking for the sign up page #4169 #5332

Merged
merged 7 commits into from
Jun 7, 2024
Merged
6 changes: 0 additions & 6 deletions packages/smooth_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ PODS:
- SDWebImageWebPCoder (0.14.6):
- libwebp (~> 1.0)
- SDWebImage/Core (~> 5.17)
- sensors_plus (0.0.1):
- Flutter
- Sentry/HybridSDK (8.21.0):
- SentryPrivate (= 8.21.0)
- sentry_flutter (0.0.1):
Expand Down Expand Up @@ -175,7 +173,6 @@ DEPENDENCIES:
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
- rive_common (from `.symlinks/plugins/rive_common/ios`)
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
Expand Down Expand Up @@ -251,8 +248,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/qr_code_scanner/ios"
rive_common:
:path: ".symlinks/plugins/rive_common/ios"
sensors_plus:
:path: ".symlinks/plugins/sensors_plus/ios"
sentry_flutter:
:path: ".symlinks/plugins/sentry_flutter/ios"
share_plus:
Expand Down Expand Up @@ -307,7 +302,6 @@ SPEC CHECKSUMS:
rive_common: cbbac3192af00d7341f19dae2f26298e9e37d99e
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
sensors_plus: 4ee32bc7d61a055f27f88d3215ad6b6fb96a2b8e
Sentry: ebc12276bd17613a114ab359074096b6b3725203
sentry_flutter: dff1df05dc39c83d04f9330b36360fc374574c5e
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe
Expand Down
10 changes: 10 additions & 0 deletions packages/smooth_app/lib/pages/navigator/app_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:smooth_app/pages/product/new_product_page.dart';
import 'package:smooth_app/pages/product/product_loader_page.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/sign_up_page.dart';
import 'package:smooth_app/query/product_query.dart';

/// A replacement for the [Navigator], where we internally use [GoRouter].
Expand Down Expand Up @@ -227,6 +228,10 @@ class _SmoothGoRouter {
return ExternalPage(path: state.uri.queryParameters['path']!);
},
),
GoRoute(
path: _InternalAppRoutes.SIGNUP_PAGE,
builder:(_, __) => const SignUpPage(),
)
],
),
],
Expand Down Expand Up @@ -278,6 +283,8 @@ class _SmoothGoRouter {
return AppRoutes.HOME;
} else if (path == _ExternalRoutes.GUIDE_NUTRISCORE_V2) {
return AppRoutes.GUIDE_NUTRISCORE_V2;
} else if (path == _ExternalRoutes.SIGNUP) {
return AppRoutes.SIGNUP;
} else if (path != _InternalAppRoutes.HOME_PAGE) {
externalLink = true;
}
Expand Down Expand Up @@ -387,6 +394,7 @@ class _InternalAppRoutes {
static const String PREFERENCES_PAGE = '_preferences';
static const String SEARCH_PAGE = '_search';
static const String EXTERNAL_PAGE = '_external';
static const String SIGNUP_PAGE = '_signup';

static const String _GUIDES = '_guides';
static const String GUIDE_NUTRISCORE_V2_PAGE = '_nutriscore-v2';
Expand All @@ -396,6 +404,7 @@ class _ExternalRoutes {
static const String MOBILE_APP_DOWNLOAD = '/open-food-facts-mobile-app';
static const String PRODUCT_EDITION = '/cgi/product.pl';
static const String GUIDE_NUTRISCORE_V2 = '/nutriscore-v2';
static const String SIGNUP = '/signup';
}

/// A list of internal routes to use with [AppNavigator]
Expand Down Expand Up @@ -440,6 +449,7 @@ class AppRoutes {
static String get GUIDE_NUTRISCORE_V2 =>
'/${_InternalAppRoutes._GUIDES}/${_InternalAppRoutes.GUIDE_NUTRISCORE_V2_PAGE}';

static String get SIGNUP => '/${_InternalAppRoutes.SIGNUP_PAGE}';
// Open an external link (where path is relative to the OFF website)
static String EXTERNAL(String path) =>
'/${_InternalAppRoutes.EXTERNAL_PAGE}/?path=$path';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:matomo_tracker/matomo_tracker.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:provider/provider.dart';
import 'package:smooth_app/data_models/preferences/user_preferences.dart';
import 'package:smooth_app/data_models/user_management_provider.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart';
Expand Down Expand Up @@ -48,7 +49,7 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {

@override
String get actionName => 'Opened sign_up_page';

@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
Expand Down Expand Up @@ -314,6 +315,7 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
}

Future<void> _signUp() async {
///add and make complete onboarding false at signup.
final AppLocalizations appLocalisations = AppLocalizations.of(context);
_disagreed = !_agree;
setState(() {});
Expand Down Expand Up @@ -411,6 +413,8 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
if (!mounted) {
return;
}
final UserPreferences userPreferences = await UserPreferences.getUserPreferences();
userPreferences.resetOnboarding();
await showDialog<void>(
context: context,
builder: (BuildContext context) => SmoothAlertDialog(
Expand Down
Loading