iOS deeplink sends "path + query" instead of just path (flutter/engine#23562)

This commit is contained in:
Sarbagya Dhaubanjar 2021-01-22 04:54:01 +05:45 committed by GitHub
parent 2c20425be9
commit 52e5aebff7
2 changed files with 8 additions and 3 deletions

View File

@ -159,8 +159,13 @@ static BOOL IsDeepLinkingEnabled(NSDictionary* infoDictionary) {
FML_LOG(ERROR)
<< "Timeout waiting for the first frame when launching an URL.";
} else {
NSString* pathAndQuery = url.path;
if ([url.query length] != 0) {
pathAndQuery =
[NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query];
}
[flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute"
arguments:url.path];
arguments:pathAndQuery];
}
}];
return YES;

View File

@ -30,7 +30,7 @@ FLUTTER_ASSERT_ARC
appDelegate.rootFlutterViewControllerGetter = ^{
return viewController;
};
NSURL* url = [NSURL URLWithString:@"http://example.com"];
NSURL* url = [NSURL URLWithString:@"http://myApp/custom/route?query=test"];
NSDictionary<UIApplicationOpenURLOptionsKey, id>* options = @{};
BOOL result = [appDelegate application:[UIApplication sharedApplication]
openURL:url
@ -39,7 +39,7 @@ FLUTTER_ASSERT_ARC
return @{@"FlutterDeepLinkingEnabled" : @(YES)};
}];
XCTAssertTrue(result);
OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:url.path]);
OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]);
}
@end