Skip to content

Commit b2d6deb

Browse files
authored
Merge pull request #466 from OpenPecha/fix-onboarding
Temporarily disable onboarding enforcement in route guard; redirect t…
2 parents 23362c3 + 59faae0 commit b2d6deb

1 file changed

Lines changed: 24 additions & 14 deletions

File tree

lib/core/config/router/route_guard.dart

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,33 @@ class RouteGuard {
5959
String? Function() getPendingRoute,
6060
void Function(String?) setPendingRoute,
6161
) async {
62-
final hasOnboarded = await onboardingRepo.isOnboardingCompleted().then(
63-
(result) =>
64-
result.fold((failure) => false, (hasCompleted) => hasCompleted),
65-
);
66-
67-
// Force onboarding if not completed
68-
if (!hasOnboarded &&
69-
path != AppRoutes.onboarding &&
70-
path != AppRoutes.login) {
71-
return AppRoutes.onboarding;
72-
}
73-
74-
// Skip onboarding if already done
75-
if (hasOnboarded && path == AppRoutes.onboarding) {
62+
// Onboarding is temporarily disabled for everyone. Never force it, and
63+
// send any direct navigation to /onboarding back to home. This also fixes
64+
// the offline case, where the original check below defaulted to "not
65+
// onboarded" and wrongly forced onboarding.
66+
if (path == AppRoutes.onboarding) {
7667
return AppRoutes.home;
7768
}
7869

70+
// Original force-onboarding logic, preserved (commented out) so it can be
71+
// re-enabled later by deleting the redirect above and uncommenting this.
72+
// final hasOnboarded = await onboardingRepo.isOnboardingCompleted().then(
73+
// (result) =>
74+
// result.fold((failure) => false, (hasCompleted) => hasCompleted),
75+
// );
76+
//
77+
// // Force onboarding if not completed
78+
// if (!hasOnboarded &&
79+
// path != AppRoutes.onboarding &&
80+
// path != AppRoutes.login) {
81+
// return AppRoutes.onboarding;
82+
// }
83+
//
84+
// // Skip onboarding if already done
85+
// if (hasOnboarded && path == AppRoutes.onboarding) {
86+
// return AppRoutes.home;
87+
// }
88+
7989
// Redirect from login or splash to pending route or home
8090
if (path == AppRoutes.login || path == AppRoutes.splash) {
8191
final pending = getPendingRoute();

0 commit comments

Comments
 (0)