Make iOS embedding to send full uri for deeplinks (flutter/engine#41992)

related https://github.com/flutter/flutter/issues/100624

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
chunhtai 2023-05-18 13:31:17 -07:00 committed by GitHub
parent 0c46b09bbf
commit d21dc12d2f
2 changed files with 11 additions and 15 deletions

View File

@ -150,17 +150,10 @@ static NSString* const kRestorationStateAppModificationKey = @"mod-date";
FML_LOG(ERROR)
<< "Timeout waiting for the first frame when launching an URL.";
} else {
NSString* fullRoute = url.path;
if ([url.query length] != 0) {
fullRoute = [NSString stringWithFormat:@"%@?%@", fullRoute, url.query];
}
if ([url.fragment length] != 0) {
fullRoute = [NSString stringWithFormat:@"%@#%@", fullRoute, url.fragment];
}
[flutterViewController.engine.navigationChannel
invokeMethod:@"pushRouteInformation"
arguments:@{
@"location" : fullRoute,
@"location" : url.absoluteString,
}];
}
}];

View File

@ -67,8 +67,9 @@ FLUTTER_ASSERT_ARC
openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
options:@{}];
XCTAssertTrue(result);
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"/custom/route?query=test"}]);
OCMVerify([self.mockNavigationChannel
invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"http://myApp/custom/route?query=test"}]);
}
- (void)testLaunchUrlWithDeepLinkingNotSet {
@ -106,7 +107,7 @@ FLUTTER_ASSERT_ARC
XCTAssertTrue(result);
OCMVerify([self.mockNavigationChannel
invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"/custom/route?query=test#fragment"}]);
arguments:@{@"location" : @"http://myApp/custom/route?query=test#fragment"}]);
}
- (void)testLaunchUrlWithFragmentNoQueryParameter {
@ -118,8 +119,9 @@ FLUTTER_ASSERT_ARC
openURL:[NSURL URLWithString:@"http://myApp/custom/route#fragment"]
options:@{}];
XCTAssertTrue(result);
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"/custom/route#fragment"}]);
OCMVerify([self.mockNavigationChannel
invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"http://myApp/custom/route#fragment"}]);
}
- (void)testReleasesWindowOnDealloc {
@ -152,8 +154,9 @@ FLUTTER_ASSERT_ARC
restorationHandler:^(NSArray<id<UIUserActivityRestoring>>* __nullable restorableObjects){
}];
XCTAssertTrue(result);
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"/custom/route?query=test"}]);
OCMVerify([self.mockNavigationChannel
invokeMethod:@"pushRouteInformation"
arguments:@{@"location" : @"http://myApp/custom/route?query=test"}]);
}
@end