Android deeplink sends "path + query" instead of just path (flutter/engine#23561)
* added .cpid & .gclient to gitignore * updated tests * minor change * fixed formating * compact concatenation * minor change * Revert "added .cpid & .gclient to gitignore" * cleanup
This commit is contained in:
committed by
GitHub
parent
074d70ce6d
commit
fbd0f1df95
@@ -399,7 +399,11 @@ import java.util.Arrays;
|
||||
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;
|
||||
|
||||
@@ -433,7 +433,7 @@ public class FlutterActivityAndFragmentDelegateTest {
|
||||
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);
|
||||
@@ -452,7 +452,8 @@ public class FlutterActivityAndFragmentDelegateTest {
|
||||
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
|
||||
@@ -491,12 +492,13 @@ public class FlutterActivityAndFragmentDelegateTest {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user