Browse Source

Merge pull request #988 from nextcloud/renovate/major-go_router

fix(deps): update dependency go_router to v12
pull/1000/head
Kate 1 year ago committed by GitHub
parent
commit
d76e515fac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      packages/app/pubspec.lock
  2. 2
      packages/neon/neon/lib/src/app.dart
  3. 85
      packages/neon/neon/lib/src/router.dart
  4. 2
      packages/neon/neon/pubspec.yaml
  5. 2
      packages/neon/neon_files/pubspec.yaml
  6. 2
      packages/neon/neon_news/pubspec.yaml
  7. 2
      packages/neon/neon_notes/pubspec.yaml
  8. 2
      packages/neon/neon_notifications/pubspec.yaml

4
packages/app/pubspec.lock

@ -433,10 +433,10 @@ packages:
dependency: transitive
description:
name: go_router
sha256: "2ccd74480706e0a70a0e0dfa9543dede41bc11d0fe3b146a6ad7b7686f6b4407"
sha256: a206cc4621a644531a2e05e7774616ab4d9d85eab1f3b0e255f3102937fccab1
url: "https://pub.dev"
source: hosted
version: "11.1.4"
version: "12.0.0"
html:
dependency: transitive
description:

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

@ -48,7 +48,7 @@ class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, tray.Tra
late final Iterable<AppImplementation> _appImplementations;
late final GlobalOptions _globalOptions;
late final AccountsBloc _accountsBloc;
late final _routerDelegate = AppRouter(
late final _routerDelegate = buildAppRouter(
navigatorKey: _navigatorKey,
accountsBloc: _accountsBloc,
);

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

@ -25,49 +25,48 @@ import 'package:neon/src/utils/stream_listenable.dart';
part 'router.g.dart';
@internal
class AppRouter extends GoRouter {
AppRouter({
required final GlobalKey<NavigatorState> navigatorKey,
required final AccountsBloc accountsBloc,
}) : super(
debugLogDiagnostics: kDebugMode,
refreshListenable: StreamListenable(accountsBloc.activeAccount),
navigatorKey: navigatorKey,
initialLocation: const HomeRoute().location,
errorPageBuilder: _buildErrorPage,
redirect: (final context, final state) {
final loginQRcode = LoginQRcode.tryParse(state.uri.toString());
if (loginQRcode != null) {
return LoginCheckServerStatusRoute.withCredentials(
serverUrl: loginQRcode.serverURL,
loginName: loginQRcode.username,
password: loginQRcode.password,
).location;
}
if (accountsBloc.hasAccounts && state.uri.hasScheme) {
final strippedUri = accountsBloc.activeAccount.value!.stripUri(state.uri);
if (strippedUri != state.uri) {
return strippedUri.toString();
}
}
// redirect to login screen when no account is logged in
if (!accountsBloc.hasAccounts && !state.uri.toString().startsWith(const LoginRoute().location)) {
return const LoginRoute().location;
}
return null;
},
routes: $appRoutes,
);
static Page<void> _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage(
child: RouteNotFoundPage(
uri: state.uri,
),
);
}
GoRouter buildAppRouter({
required final GlobalKey<NavigatorState> navigatorKey,
required final AccountsBloc accountsBloc,
}) =>
GoRouter(
debugLogDiagnostics: kDebugMode,
refreshListenable: StreamListenable(accountsBloc.activeAccount),
navigatorKey: navigatorKey,
initialLocation: const HomeRoute().location,
errorPageBuilder: _buildErrorPage,
redirect: (final context, final state) {
final loginQRcode = LoginQRcode.tryParse(state.uri.toString());
if (loginQRcode != null) {
return LoginCheckServerStatusRoute.withCredentials(
serverUrl: loginQRcode.serverURL,
loginName: loginQRcode.username,
password: loginQRcode.password,
).location;
}
if (accountsBloc.hasAccounts && state.uri.hasScheme) {
final strippedUri = accountsBloc.activeAccount.value!.stripUri(state.uri);
if (strippedUri != state.uri) {
return strippedUri.toString();
}
}
// redirect to login screen when no account is logged in
if (!accountsBloc.hasAccounts && !state.uri.toString().startsWith(const LoginRoute().location)) {
return const LoginRoute().location;
}
return null;
},
routes: $appRoutes,
);
Page<void> _buildErrorPage(final BuildContext context, final GoRouterState state) => MaterialPage(
child: RouteNotFoundPage(
uri: state.uri,
),
);
@immutable
class AccountSettingsRoute extends GoRouteData {

2
packages/neon/neon/pubspec.yaml

@ -22,7 +22,7 @@ dependencies:
flutter_native_splash: ^2.0.0
flutter_svg: ^2.0.0
flutter_zxing: ^1.0.0
go_router: ^11.0.0
go_router: ^12.0.0
http: ^1.0.0
image: ^4.0.0
intersperse: ^2.0.0

2
packages/neon/neon_files/pubspec.yaml

@ -19,7 +19,7 @@ dependencies:
flutter_localizations:
sdk: flutter
flutter_material_design_icons: ^1.0.0
go_router: ^11.0.0
go_router: ^12.0.0
image_picker: ^1.0.0
intl: ^0.18.0
neon:

2
packages/neon/neon_news/pubspec.yaml

@ -13,7 +13,7 @@ dependencies:
flutter_localizations:
sdk: flutter
flutter_material_design_icons: ^1.0.0
go_router: ^11.0.0
go_router: ^12.0.0
html: ^0.15.0
intl: ^0.18.0
neon:

2
packages/neon/neon_notes/pubspec.yaml

@ -15,7 +15,7 @@ dependencies:
sdk: flutter
flutter_markdown: ^0.6.0
flutter_material_design_icons: ^1.0.0
go_router: ^11.0.0
go_router: ^12.0.0
intl: ^0.18.0
neon:
git:

2
packages/neon/neon_notifications/pubspec.yaml

@ -12,7 +12,7 @@ dependencies:
flutter_localizations:
sdk: flutter
flutter_material_design_icons: ^1.0.0
go_router: ^11.0.0
go_router: ^12.0.0
intl: ^0.18.0
neon:
git:

Loading…
Cancel
Save