Skip to content

Commit ac6f3ed

Browse files
renovate[bot]provokateurin
authored andcommitted
fix(deps): update dependency go_router to v12
1 parent cd2cb0b commit ac6f3ed

File tree

8 files changed

+50
-51
lines changed

8 files changed

+50
-51
lines changed

packages/app/pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ packages:
433433
dependency: transitive
434434
description:
435435
name: go_router
436-
sha256: "2ccd74480706e0a70a0e0dfa9543dede41bc11d0fe3b146a6ad7b7686f6b4407"
436+
sha256: a206cc4621a644531a2e05e7774616ab4d9d85eab1f3b0e255f3102937fccab1
437437
url: "https://pub.dev"
438438
source: hosted
439-
version: "11.1.4"
439+
version: "12.0.0"
440440
html:
441441
dependency: transitive
442442
description:

packages/neon/neon/lib/src/app.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
4848
late final Iterable<AppImplementation> _appImplementations;
4949
late final GlobalOptions _globalOptions;
5050
late final AccountsBloc _accountsBloc;
51-
late final _routerDelegate = AppRouter(
51+
late final _routerDelegate = buildAppRouter(
5252
navigatorKey: _navigatorKey,
5353
accountsBloc: _accountsBloc,
5454
);

packages/neon/neon/lib/src/router.dart

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,48 @@ import 'package:neon/src/utils/stream_listenable.dart';
2525
part 'router.g.dart';
2626

2727
@internal
28-
class AppRouter extends GoRouter {
29-
AppRouter({
30-
required final GlobalKey<NavigatorState> navigatorKey,
31-
required final AccountsBloc accountsBloc,
32-
}) : super(
33-
debugLogDiagnostics: kDebugMode,
34-
refreshListenable: StreamListenable(accountsBloc.activeAccount),
35-
navigatorKey: navigatorKey,
36-
initialLocation: const HomeRoute().location,
37-
errorPageBuilder: _buildErrorPage,
38-
redirect: (final context, final state) {
39-
final loginQRcode = LoginQRcode.tryParse(state.uri.toString());
40-
if (loginQRcode != null) {
41-
return LoginCheckServerStatusRoute.withCredentials(
42-
serverUrl: loginQRcode.serverURL,
43-
loginName: loginQRcode.username,
44-
password: loginQRcode.password,
45-
).location;
46-
}
47-
48-
if (accountsBloc.hasAccounts && state.uri.hasScheme) {
49-
final strippedUri = accountsBloc.activeAccount.value!.stripUri(state.uri);
50-
if (strippedUri != state.uri) {
51-
return strippedUri.toString();
52-
}
53-
}
54-
55-
// redirect to login screen when no account is logged in
56-
if (!accountsBloc.hasAccounts && !state.uri.toString().startsWith(const LoginRoute().location)) {
57-
return const LoginRoute().location;
58-
}
59-
60-
return null;
61-
},
62-
routes: $appRoutes,
63-
);
64-
65-
static Page<void> _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage(
66-
child: RouteNotFoundPage(
67-
uri: state.uri,
68-
),
69-
);
70-
}
28+
GoRouter buildAppRouter({
29+
required final GlobalKey<NavigatorState> navigatorKey,
30+
required final AccountsBloc accountsBloc,
31+
}) =>
32+
GoRouter(
33+
debugLogDiagnostics: kDebugMode,
34+
refreshListenable: StreamListenable(accountsBloc.activeAccount),
35+
navigatorKey: navigatorKey,
36+
initialLocation: const HomeRoute().location,
37+
errorPageBuilder: _buildErrorPage,
38+
redirect: (final context, final state) {
39+
final loginQRcode = LoginQRcode.tryParse(state.uri.toString());
40+
if (loginQRcode != null) {
41+
return LoginCheckServerStatusRoute.withCredentials(
42+
serverUrl: loginQRcode.serverURL,
43+
loginName: loginQRcode.username,
44+
password: loginQRcode.password,
45+
).location;
46+
}
47+
48+
if (accountsBloc.hasAccounts && state.uri.hasScheme) {
49+
final strippedUri = accountsBloc.activeAccount.value!.stripUri(state.uri);
50+
if (strippedUri != state.uri) {
51+
return strippedUri.toString();
52+
}
53+
}
54+
55+
// redirect to login screen when no account is logged in
56+
if (!accountsBloc.hasAccounts && !state.uri.toString().startsWith(const LoginRoute().location)) {
57+
return const LoginRoute().location;
58+
}
59+
60+
return null;
61+
},
62+
routes: $appRoutes,
63+
);
64+
65+
Page<void> _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage(
66+
child: RouteNotFoundPage(
67+
uri: state.uri,
68+
),
69+
);
7170

7271
@immutable
7372
class AccountSettingsRoute extends GoRouteData {

packages/neon/neon/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222
flutter_native_splash: ^2.0.0
2323
flutter_svg: ^2.0.0
2424
flutter_zxing: ^1.0.0
25-
go_router: ^11.0.0
25+
go_router: ^12.0.0
2626
http: ^1.0.0
2727
image: ^4.0.0
2828
intersperse: ^2.0.0

packages/neon/neon_files/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ dependencies:
1919
flutter_localizations:
2020
sdk: flutter
2121
flutter_material_design_icons: ^1.0.0
22-
go_router: ^11.0.0
22+
go_router: ^12.0.0
2323
image_picker: ^1.0.0
2424
intl: ^0.18.0
2525
neon:

packages/neon/neon_news/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
flutter_localizations:
1414
sdk: flutter
1515
flutter_material_design_icons: ^1.0.0
16-
go_router: ^11.0.0
16+
go_router: ^12.0.0
1717
html: ^0.15.0
1818
intl: ^0.18.0
1919
neon:

packages/neon/neon_notes/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
sdk: flutter
1616
flutter_markdown: ^0.6.0
1717
flutter_material_design_icons: ^1.0.0
18-
go_router: ^11.0.0
18+
go_router: ^12.0.0
1919
intl: ^0.18.0
2020
neon:
2121
git:

packages/neon/neon_notifications/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
flutter_localizations:
1313
sdk: flutter
1414
flutter_material_design_icons: ^1.0.0
15-
go_router: ^11.0.0
15+
go_router: ^12.0.0
1616
intl: ^0.18.0
1717
neon:
1818
git:

0 commit comments

Comments
 (0)