File tree 3 files changed +22
-10
lines changed
packages/catalyst_voices_blocs/lib/src/session
3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,20 @@ final class MilestoneGuard implements RouteGuard {
12
12
13
13
@override
14
14
FutureOr <String ?> redirect (BuildContext context, GoRouterState state) {
15
+ final location = state.uri.toString ();
16
+
17
+ // redirects /m4 page to /m4/discovery
18
+ if (location == '/${Routes .currentMilestone }' ) {
19
+ return const DiscoveryRoute ().location;
20
+ }
21
+
15
22
// allow milestone sub pages
16
- if (state.uri. toString () .startsWith ('/${Routes .currentMilestone }' )) {
23
+ if (location .startsWith ('/${Routes .currentMilestone }' )) {
17
24
return null ;
18
25
}
19
26
20
27
// if already at destination skip redirect
21
- if (state.uri. toString () == const ComingSoonRoute ().location) {
28
+ if (location == const ComingSoonRoute ().location) {
22
29
return null ;
23
30
}
24
31
Original file line number Diff line number Diff line change @@ -11,14 +11,14 @@ import 'package:go_router/go_router.dart';
11
11
abstract final class Routes {
12
12
static const currentMilestone = 'm4' ;
13
13
14
+ static final List <RouteBase > routes = [
15
+ ...coming_soon.$appRoutes,
16
+ ...login.$appRoutes,
17
+ ...spaces.$appRoutes,
18
+ ...overall_spaces.$appRoutes,
19
+ ];
20
+
14
21
static String get initialLocation {
15
22
return const coming_soon.ComingSoonRoute ().location;
16
23
}
17
-
18
- static List <RouteBase > get routes => [
19
- ...coming_soon.$appRoutes,
20
- ...login.$appRoutes,
21
- ...spaces.$appRoutes,
22
- ...overall_spaces.$appRoutes,
23
- ];
24
24
}
Original file line number Diff line number Diff line change @@ -5,7 +5,12 @@ import 'package:flutter_bloc/flutter_bloc.dart';
5
5
6
6
/// Manages the user session.
7
7
final class SessionBloc extends Bloc <SessionEvent , SessionState > {
8
- SessionBloc () : super (const VisitorSessionState ()) {
8
+ SessionBloc ()
9
+ : super (
10
+ const ActiveUserSessionState (
11
+ user: User (name: 'Account' ),
12
+ ),
13
+ ) {
9
14
on < SessionEvent > (_handleSessionEvent);
10
15
}
11
16
You can’t perform that action at this time.
0 commit comments