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:
@@ -150,17 +150,10 @@ static NSString* const kRestorationStateAppModificationKey = @"mod-date";
|
|||||||
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* 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
|
[flutterViewController.engine.navigationChannel
|
||||||
invokeMethod:@"pushRouteInformation"
|
invokeMethod:@"pushRouteInformation"
|
||||||
arguments:@{
|
arguments:@{
|
||||||
@"location" : fullRoute,
|
@"location" : url.absoluteString,
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|||||||
@@ -67,8 +67,9 @@ FLUTTER_ASSERT_ARC
|
|||||||
openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
|
openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
|
||||||
options:@{}];
|
options:@{}];
|
||||||
XCTAssertTrue(result);
|
XCTAssertTrue(result);
|
||||||
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
|
OCMVerify([self.mockNavigationChannel
|
||||||
arguments:@{@"location" : @"/custom/route?query=test"}]);
|
invokeMethod:@"pushRouteInformation"
|
||||||
|
arguments:@{@"location" : @"http://myApp/custom/route?query=test"}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testLaunchUrlWithDeepLinkingNotSet {
|
- (void)testLaunchUrlWithDeepLinkingNotSet {
|
||||||
@@ -106,7 +107,7 @@ FLUTTER_ASSERT_ARC
|
|||||||
XCTAssertTrue(result);
|
XCTAssertTrue(result);
|
||||||
OCMVerify([self.mockNavigationChannel
|
OCMVerify([self.mockNavigationChannel
|
||||||
invokeMethod:@"pushRouteInformation"
|
invokeMethod:@"pushRouteInformation"
|
||||||
arguments:@{@"location" : @"/custom/route?query=test#fragment"}]);
|
arguments:@{@"location" : @"http://myApp/custom/route?query=test#fragment"}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testLaunchUrlWithFragmentNoQueryParameter {
|
- (void)testLaunchUrlWithFragmentNoQueryParameter {
|
||||||
@@ -118,8 +119,9 @@ FLUTTER_ASSERT_ARC
|
|||||||
openURL:[NSURL URLWithString:@"http://myApp/custom/route#fragment"]
|
openURL:[NSURL URLWithString:@"http://myApp/custom/route#fragment"]
|
||||||
options:@{}];
|
options:@{}];
|
||||||
XCTAssertTrue(result);
|
XCTAssertTrue(result);
|
||||||
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
|
OCMVerify([self.mockNavigationChannel
|
||||||
arguments:@{@"location" : @"/custom/route#fragment"}]);
|
invokeMethod:@"pushRouteInformation"
|
||||||
|
arguments:@{@"location" : @"http://myApp/custom/route#fragment"}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testReleasesWindowOnDealloc {
|
- (void)testReleasesWindowOnDealloc {
|
||||||
@@ -152,8 +154,9 @@ FLUTTER_ASSERT_ARC
|
|||||||
restorationHandler:^(NSArray<id<UIUserActivityRestoring>>* __nullable restorableObjects){
|
restorationHandler:^(NSArray<id<UIUserActivityRestoring>>* __nullable restorableObjects){
|
||||||
}];
|
}];
|
||||||
XCTAssertTrue(result);
|
XCTAssertTrue(result);
|
||||||
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
|
OCMVerify([self.mockNavigationChannel
|
||||||
arguments:@{@"location" : @"/custom/route?query=test"}]);
|
invokeMethod:@"pushRouteInformation"
|
||||||
|
arguments:@{@"location" : @"http://myApp/custom/route?query=test"}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user