Skip to content

Commit

Permalink
feat: made it so that the user goes to onboarding after sign up
Browse files Browse the repository at this point in the history
  • Loading branch information
jnnabugwu committed Jun 2, 2024
1 parent c0e6ab1 commit bb1462c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/smooth_app/lib/pages/user_management/sign_up_page.dart
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 @@ -46,8 +47,20 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
bool _subscribe = false;
bool _disagreed = false;

late UserPreferences _userPreferences;

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

@override
void initState() {
super.initState();
getUserPreferences();
}

Future<void> getUserPreferences() async {
_userPreferences = await UserPreferences.getUserPreferences();
}

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -314,6 +327,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 +425,8 @@ class _SignUpPageState extends State<SignUpPage> with TraceableClientMixin {
if (!mounted) {
return;
}
debugPrint('Reseting Onboarding');
_userPreferences.resetOnboarding();
await showDialog<void>(
context: context,
builder: (BuildContext context) => SmoothAlertDialog(
Expand Down

0 comments on commit bb1462c

Please sign in to comment.