Skip to content

Commit

Permalink
iOS deeplink sends "path + query" instead of just path (#23562)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbagyastha committed Jan 21, 2021
1 parent 87960d8 commit 7f66714
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Expand Up @@ -159,8 +159,13 @@ - (BOOL)application:(UIApplication*)application
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;
Expand Down
Expand Up @@ -30,7 +30,7 @@ - (void)skip_testLaunchUrl {
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
Expand All @@ -39,7 +39,7 @@ - (void)skip_testLaunchUrl {
return @{@"FlutterDeepLinkingEnabled" : @(YES)};
}];
XCTAssertTrue(result);
OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:url.path]);
OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]);
}

@end

0 comments on commit 7f66714

Please sign in to comment.