Skip to content

Commit

Permalink
default to wallet route parser if wallet only
Browse files Browse the repository at this point in the history
  • Loading branch information
naezith authored and takenagain committed Jan 27, 2025
1 parent cafd428 commit 96f93e7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/router/parsers/root_route_parser.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:web_dex/app_config/app_config.dart';
import 'package:web_dex/model/first_uri_segment.dart';
import 'package:web_dex/router/parsers/base_route_parser.dart';
import 'package:web_dex/router/parsers/bridge_route_parser.dart';
Expand All @@ -22,10 +23,10 @@ class RootRouteInformationParser extends RouteInformationParser<AppRoutePath> {
@override
Future<AppRoutePath> parseRouteInformation(
RouteInformation routeInformation) async {
final BaseRouteParser parser =
_getRoutParser(Uri.parse(routeInformation.uri.path));
final uri = Uri.parse(routeInformation.uri.path);
final BaseRouteParser parser = _getRoutParser(uri);

return parser.getRoutePath(routeInformation.uri);
return parser.getRoutePath(uri);
}

@override
Expand All @@ -34,7 +35,10 @@ class RootRouteInformationParser extends RouteInformationParser<AppRoutePath> {
}

BaseRouteParser _getRoutParser(Uri uri) {
if (uri.pathSegments.isEmpty) return dexRouteParser;
return _parsers[uri.pathSegments.first] ?? dexRouteParser;
const defaultRouteParser =
kIsWalletOnly ? walletRouteParser : dexRouteParser;

if (uri.pathSegments.isEmpty) return defaultRouteParser;
return _parsers[uri.pathSegments.first] ?? defaultRouteParser;
}
}

0 comments on commit 96f93e7

Please sign in to comment.