iOS deeplink sends "path + query" instead of just path (flutter/engine#23562)
This commit is contained in:
committed by
GitHub
parent
2c20425be9
commit
52e5aebff7
@@ -159,8 +159,13 @@ static BOOL IsDeepLinkingEnabled(NSDictionary* infoDictionary) {
|
|||||||
FML_LOG(ERROR)
|
FML_LOG(ERROR)
|
||||||
<< "Timeout waiting for the first frame when launching an URL.";
|
<< "Timeout waiting for the first frame when launching an URL.";
|
||||||
} else {
|
} else {
|
||||||
|
NSString* pathAndQuery = url.path;
|
||||||
|
if ([url.query length] != 0) {
|
||||||
|
pathAndQuery =
|
||||||
|
[NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query];
|
||||||
|
}
|
||||||
[flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute"
|
[flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute"
|
||||||
arguments:url.path];
|
arguments:pathAndQuery];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ FLUTTER_ASSERT_ARC
|
|||||||
appDelegate.rootFlutterViewControllerGetter = ^{
|
appDelegate.rootFlutterViewControllerGetter = ^{
|
||||||
return viewController;
|
return viewController;
|
||||||
};
|
};
|
||||||
NSURL* url = [NSURL URLWithString:@"http://example.com"];
|
NSURL* url = [NSURL URLWithString:@"http://myApp/custom/route?query=test"];
|
||||||
NSDictionary<UIApplicationOpenURLOptionsKey, id>* options = @{};
|
NSDictionary<UIApplicationOpenURLOptionsKey, id>* options = @{};
|
||||||
BOOL result = [appDelegate application:[UIApplication sharedApplication]
|
BOOL result = [appDelegate application:[UIApplication sharedApplication]
|
||||||
openURL:url
|
openURL:url
|
||||||
@@ -39,7 +39,7 @@ FLUTTER_ASSERT_ARC
|
|||||||
return @{@"FlutterDeepLinkingEnabled" : @(YES)};
|
return @{@"FlutterDeepLinkingEnabled" : @(YES)};
|
||||||
}];
|
}];
|
||||||
XCTAssertTrue(result);
|
XCTAssertTrue(result);
|
||||||
OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:url.path]);
|
OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user