Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,11 @@ private String maybeGetInitialRouteFromIntent(Intent intent) {
if (host.shouldHandleDeeplinking()) {
Uri data = intent.getData();
if (data != null && !data.getPath().isEmpty()) {
return data.getPath();
String pathAndQuery = data.getPath();
if (!data.getQuery().isEmpty()) {
pathAndQuery += "?" + data.getQuery();
}
return pathAndQuery;
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public void itForwardsOnRequestPermissionsResultToFlutterEngine() {
public void
itSendsInitialRouteFromIntentOnStartIfNoInitialRouteFromActivityAndShouldHandleDeeplinking() {
Intent intent = FlutterActivity.createDefaultIntent(RuntimeEnvironment.application);
intent.setData(Uri.parse("http://myApp/custom/route"));
intent.setData(Uri.parse("http://myApp/custom/route?query=test"));

ActivityController<FlutterActivity> activityController =
Robolectric.buildActivity(FlutterActivity.class, intent);
Expand All @@ -452,7 +452,8 @@ public void itForwardsOnRequestPermissionsResultToFlutterEngine() {
delegate.onStart();

// Verify that the navigation channel was given the initial route message.
verify(mockFlutterEngine.getNavigationChannel(), times(1)).setInitialRoute("/custom/route");
verify(mockFlutterEngine.getNavigationChannel(), times(1))
.setInitialRoute("/custom/route?query=test");
}

@Test
Expand Down Expand Up @@ -491,12 +492,13 @@ public void itSendsPushRouteMessageWhenOnNewIntent() {
delegate.onAttach(RuntimeEnvironment.application);

Intent mockIntent = mock(Intent.class);
when(mockIntent.getData()).thenReturn(Uri.parse("http://myApp/custom/route"));
when(mockIntent.getData()).thenReturn(Uri.parse("http://myApp/custom/route?query=test"));
// Emulate the host and call the method that we expect to be forwarded.
delegate.onNewIntent(mockIntent);

// Verify that the navigation channel was given the push route message.
verify(mockFlutterEngine.getNavigationChannel(), times(1)).pushRoute("/custom/route");
verify(mockFlutterEngine.getNavigationChannel(), times(1))
.pushRoute("/custom/route?query=test");
}

@Test
Expand Down