Skip to content

Commit 2e44edb

Browse files
authored
feat: added deeplinking for the sign up page openfoodfacts#4169 (openfoodfacts#5332)
* feat: added sign up deeplink openfoodfacts#4169 * feat: made it so that the user goes to onboarding after sign up * feat: added deeplinking for the sign up page openfoodfacts#4169 ### What <!-- Added deep linking for the sign up page--> - <!-- Changed x to achieve y --> <!-- Please name your pull request following this scheme: `type: What you did` this allows us to automatically generate the changelog Following `type`s are allowed: - `feat`, for Features - `fix`, for Bug Fixes - `docs`, for Documentation - `ci`, for Automation - `refactor`, for code Refactoring - `chore`, for Miscellaneous things --> ### Screenshot <!-- Insert a screenshot to provide visual record of your changes, if visible --> ### Fixes bug(s) <!-- change by appropriate issues. --> <!-- Please use a linking keyword https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword --> - Fixes: <!-- #1 Note: you can also use Closes: --> ### Part of - openfoodfacts#525 <!-- Add the most granular issue possible --> * feat: added an external link for the signup page * feat: moved the getting of user preferences to the success state only
1 parent 2c5187c commit 2e44edb

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

packages/smooth_app/ios/Podfile.lock

-6
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ PODS:
130130
- SDWebImageWebPCoder (0.14.6):
131131
- libwebp (~> 1.0)
132132
- SDWebImage/Core (~> 5.17)
133-
- sensors_plus (0.0.1):
134-
- Flutter
135133
- Sentry/HybridSDK (8.21.0):
136134
- SentryPrivate (= 8.21.0)
137135
- sentry_flutter (0.0.1):
@@ -175,7 +173,6 @@ DEPENDENCIES:
175173
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
176174
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
177175
- rive_common (from `.symlinks/plugins/rive_common/ios`)
178-
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
179176
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
180177
- share_plus (from `.symlinks/plugins/share_plus/ios`)
181178
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
@@ -251,8 +248,6 @@ EXTERNAL SOURCES:
251248
:path: ".symlinks/plugins/qr_code_scanner/ios"
252249
rive_common:
253250
:path: ".symlinks/plugins/rive_common/ios"
254-
sensors_plus:
255-
:path: ".symlinks/plugins/sensors_plus/ios"
256251
sentry_flutter:
257252
:path: ".symlinks/plugins/sentry_flutter/ios"
258253
share_plus:
@@ -307,7 +302,6 @@ SPEC CHECKSUMS:
307302
rive_common: cbbac3192af00d7341f19dae2f26298e9e37d99e
308303
SDWebImage: dfe95b2466a9823cf9f0c6d01217c06550d7b29a
309304
SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
310-
sensors_plus: 4ee32bc7d61a055f27f88d3215ad6b6fb96a2b8e
311305
Sentry: ebc12276bd17613a114ab359074096b6b3725203
312306
sentry_flutter: dff1df05dc39c83d04f9330b36360fc374574c5e
313307
SentryPrivate: d651efb234cf385ec9a1cdd3eff94b5e78a0e0fe

packages/smooth_app/lib/pages/navigator/app_navigator.dart

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import 'package:smooth_app/pages/product/new_product_page.dart';
1919
import 'package:smooth_app/pages/product/product_loader_page.dart';
2020
import 'package:smooth_app/pages/scan/search_page.dart';
2121
import 'package:smooth_app/pages/scan/search_product_helper.dart';
22+
import 'package:smooth_app/pages/user_management/sign_up_page.dart';
2223
import 'package:smooth_app/query/product_query.dart';
2324

2425
/// A replacement for the [Navigator], where we internally use [GoRouter].
@@ -227,6 +228,10 @@ class _SmoothGoRouter {
227228
return ExternalPage(path: state.uri.queryParameters['path']!);
228229
},
229230
),
231+
GoRoute(
232+
path: _InternalAppRoutes.SIGNUP_PAGE,
233+
builder:(_, __) => const SignUpPage(),
234+
)
230235
],
231236
),
232237
],
@@ -278,6 +283,8 @@ class _SmoothGoRouter {
278283
return AppRoutes.HOME;
279284
} else if (path == _ExternalRoutes.GUIDE_NUTRISCORE_V2) {
280285
return AppRoutes.GUIDE_NUTRISCORE_V2;
286+
} else if (path == _ExternalRoutes.SIGNUP) {
287+
return AppRoutes.SIGNUP;
281288
} else if (path != _InternalAppRoutes.HOME_PAGE) {
282289
externalLink = true;
283290
}
@@ -387,6 +394,7 @@ class _InternalAppRoutes {
387394
static const String PREFERENCES_PAGE = '_preferences';
388395
static const String SEARCH_PAGE = '_search';
389396
static const String EXTERNAL_PAGE = '_external';
397+
static const String SIGNUP_PAGE = '_signup';
390398

391399
static const String _GUIDES = '_guides';
392400
static const String GUIDE_NUTRISCORE_V2_PAGE = '_nutriscore-v2';
@@ -396,6 +404,7 @@ class _ExternalRoutes {
396404
static const String MOBILE_APP_DOWNLOAD = '/open-food-facts-mobile-app';
397405
static const String PRODUCT_EDITION = '/cgi/product.pl';
398406
static const String GUIDE_NUTRISCORE_V2 = '/nutriscore-v2';
407+
static const String SIGNUP = '/signup';
399408
}
400409

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

452+
static String get SIGNUP => '/${_InternalAppRoutes.SIGNUP_PAGE}';
443453
// Open an external link (where path is relative to the OFF website)
444454
static String EXTERNAL(String path) =>
445455
'/${_InternalAppRoutes.EXTERNAL_PAGE}/?path=$path';

packages/smooth_app/lib/pages/user_management/sign_up_page.dart

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
44
import 'package:matomo_tracker/matomo_tracker.dart';
55
import 'package:openfoodfacts/openfoodfacts.dart';
66
import 'package:provider/provider.dart';
7+
import 'package:smooth_app/data_models/preferences/user_preferences.dart';
78
import 'package:smooth_app/data_models/user_management_provider.dart';
89
import 'package:smooth_app/generic_lib/design_constants.dart';
910
import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart';
@@ -48,7 +49,7 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
4849

4950
@override
5051
String get actionName => 'Opened sign_up_page';
51-
52+
5253
@override
5354
Widget build(BuildContext context) {
5455
final ThemeData theme = Theme.of(context);
@@ -314,6 +315,7 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
314315
}
315316

316317
Future<void> _signUp() async {
318+
///add and make complete onboarding false at signup.
317319
final AppLocalizations appLocalisations = AppLocalizations.of(context);
318320
_disagreed = !_agree;
319321
setState(() {});
@@ -411,6 +413,8 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
411413
if (!mounted) {
412414
return;
413415
}
416+
final UserPreferences userPreferences = await UserPreferences.getUserPreferences();
417+
userPreferences.resetOnboarding();
414418
await showDialog<void>(
415419
context: context,
416420
builder: (BuildContext context) => SmoothAlertDialog(

0 commit comments

Comments
 (0)