From faa4d9126becb785078956d9630c8e5b25d7684b Mon Sep 17 00:00:00 2001 From: Fabian Freund Date: Mon, 27 Oct 2025 05:04:43 +0100 Subject: [PATCH] use query parameter --- app/lib/core/routing/routes.browser.dart | 10 ++++++--- app/lib/core/routing/routes.g.dart | 21 ++++++++++++------- .../widgets/browser_modules/browser_view.dart | 6 ++++-- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/app/lib/core/routing/routes.browser.dart b/app/lib/core/routing/routes.browser.dart index d9a14050..3b533ec6 100644 --- a/app/lib/core/routing/routes.browser.dart +++ b/app/lib/core/routing/routes.browser.dart @@ -181,13 +181,17 @@ class TabTreeRoute extends GoRouteData with $TabTreeRoute { } class OpenSharedContentRoute extends GoRouteData with $OpenSharedContentRoute { - final Uri $extra; + final String sharedUrl; - const OpenSharedContentRoute(this.$extra); + const OpenSharedContentRoute({this.sharedUrl = 'about:blank'}); @override Page buildPage(BuildContext context, GoRouterState state) { - return DialogPage(builder: (_) => OpenSharedContent(sharedUrl: $extra)); + return DialogPage( + builder: (_) => OpenSharedContent( + sharedUrl: Uri.tryParse(sharedUrl) ?? Uri.parse('about:blank'), + ), + ); } } diff --git a/app/lib/core/routing/routes.g.dart b/app/lib/core/routing/routes.g.dart index c397fa32..443078dc 100644 --- a/app/lib/core/routing/routes.g.dart +++ b/app/lib/core/routing/routes.g.dart @@ -710,27 +710,32 @@ mixin $TabTreeRoute on GoRouteData { mixin $OpenSharedContentRoute on GoRouteData { static OpenSharedContentRoute _fromState(GoRouterState state) => - OpenSharedContentRoute(state.extra as Uri); + OpenSharedContentRoute( + sharedUrl: state.uri.queryParameters['shared-url'] ?? 'about:blank', + ); OpenSharedContentRoute get _self => this as OpenSharedContentRoute; @override - String get location => GoRouteData.$location('/open_content'); + String get location => GoRouteData.$location( + '/open_content', + queryParams: { + if (_self.sharedUrl != 'about:blank') 'shared-url': _self.sharedUrl, + }, + ); @override - void go(BuildContext context) => context.go(location, extra: _self.$extra); + void go(BuildContext context) => context.go(location); @override - Future push(BuildContext context) => - context.push(location, extra: _self.$extra); + Future push(BuildContext context) => context.push(location); @override void pushReplacement(BuildContext context) => - context.pushReplacement(location, extra: _self.$extra); + context.pushReplacement(location); @override - void replace(BuildContext context) => - context.replace(location, extra: _self.$extra); + void replace(BuildContext context) => context.replace(location); } T? _$convertMapValue( diff --git a/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart b/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart index f93e5df2..20b3a27a 100644 --- a/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart +++ b/app/lib/features/geckoview/features/browser/presentation/widgets/browser_modules/browser_view.dart @@ -192,8 +192,10 @@ class _BrowserViewState extends ConsumerState case TabIntentOpenSetting.ask: switch (sharedContent) { case SharedUrl(): - final route = OpenSharedContentRoute(sharedContent.url); - await router.push(route.location, extra: route.$extra); + final route = OpenSharedContentRoute( + sharedUrl: sharedContent.url.toString(), + ); + await router.push(route.location); case SharedText(): final route = SearchRoute( tabType: