fixes android deeplink to push the path only (flutter/engine#23255)

This commit is contained in:
chunhtai
2021-01-05 11:14:01 -08:00
committed by GitHub
parent 7ade7e0846
commit 8b7e018dbf
2 changed files with 4 additions and 6 deletions

View File

@@ -398,8 +398,8 @@ import java.util.Arrays;
private String maybeGetInitialRouteFromIntent(Intent intent) {
if (host.shouldHandleDeeplinking()) {
Uri data = intent.getData();
if (data != null && !data.toString().isEmpty()) {
return data.toString();
if (data != null && !data.getPath().isEmpty()) {
return data.getPath();
}
}
return null;

View File

@@ -452,8 +452,7 @@ public class FlutterActivityAndFragmentDelegateTest {
delegate.onStart();
// Verify that the navigation channel was given the initial route message.
verify(mockFlutterEngine.getNavigationChannel(), times(1))
.setInitialRoute("http://myApp/custom/route");
verify(mockFlutterEngine.getNavigationChannel(), times(1)).setInitialRoute("/custom/route");
}
@Test
@@ -497,8 +496,7 @@ public class FlutterActivityAndFragmentDelegateTest {
delegate.onNewIntent(mockIntent);
// Verify that the navigation channel was given the push route message.
verify(mockFlutterEngine.getNavigationChannel(), times(1))
.pushRoute("http://myApp/custom/route");
verify(mockFlutterEngine.getNavigationChannel(), times(1)).pushRoute("/custom/route");
}
@Test