Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit c7c679d

Browse files
authored
Make iOS embedding to send full uri for deeplinks (#41992)
related flutter/flutter#100624 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 2c77c80 commit c7c679d

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,17 +150,10 @@ - (BOOL)openURL:(NSURL*)url {
150150
FML_LOG(ERROR)
151151
<< "Timeout waiting for the first frame when launching an URL.";
152152
} else {
153-
NSString* fullRoute = url.path;
154-
if ([url.query length] != 0) {
155-
fullRoute = [NSString stringWithFormat:@"%@?%@", fullRoute, url.query];
156-
}
157-
if ([url.fragment length] != 0) {
158-
fullRoute = [NSString stringWithFormat:@"%@#%@", fullRoute, url.fragment];
159-
}
160153
[flutterViewController.engine.navigationChannel
161154
invokeMethod:@"pushRouteInformation"
162155
arguments:@{
163-
@"location" : fullRoute,
156+
@"location" : url.absoluteString,
164157
}];
165158
}
166159
}];

shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ - (void)testLaunchUrl {
6767
openURL:[NSURL URLWithString:@"http://myApp/custom/route?query=test"]
6868
options:@{}];
6969
XCTAssertTrue(result);
70-
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
71-
arguments:@{@"location" : @"/custom/route?query=test"}]);
70+
OCMVerify([self.mockNavigationChannel
71+
invokeMethod:@"pushRouteInformation"
72+
arguments:@{@"location" : @"http://myApp/custom/route?query=test"}]);
7273
}
7374

7475
- (void)testLaunchUrlWithDeepLinkingNotSet {
@@ -106,7 +107,7 @@ - (void)testLaunchUrlWithQueryParameterAndFragment {
106107
XCTAssertTrue(result);
107108
OCMVerify([self.mockNavigationChannel
108109
invokeMethod:@"pushRouteInformation"
109-
arguments:@{@"location" : @"/custom/route?query=test#fragment"}]);
110+
arguments:@{@"location" : @"http://myApp/custom/route?query=test#fragment"}]);
110111
}
111112

112113
- (void)testLaunchUrlWithFragmentNoQueryParameter {
@@ -118,8 +119,9 @@ - (void)testLaunchUrlWithFragmentNoQueryParameter {
118119
openURL:[NSURL URLWithString:@"http://myApp/custom/route#fragment"]
119120
options:@{}];
120121
XCTAssertTrue(result);
121-
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
122-
arguments:@{@"location" : @"/custom/route#fragment"}]);
122+
OCMVerify([self.mockNavigationChannel
123+
invokeMethod:@"pushRouteInformation"
124+
arguments:@{@"location" : @"http://myApp/custom/route#fragment"}]);
123125
}
124126

125127
- (void)testReleasesWindowOnDealloc {
@@ -152,8 +154,9 @@ - (void)testUniversalLinkPushRouteInformation {
152154
restorationHandler:^(NSArray<id<UIUserActivityRestoring>>* __nullable restorableObjects){
153155
}];
154156
XCTAssertTrue(result);
155-
OCMVerify([self.mockNavigationChannel invokeMethod:@"pushRouteInformation"
156-
arguments:@{@"location" : @"/custom/route?query=test"}]);
157+
OCMVerify([self.mockNavigationChannel
158+
invokeMethod:@"pushRouteInformation"
159+
arguments:@{@"location" : @"http://myApp/custom/route?query=test"}]);
157160
}
158161

159162
@end

0 commit comments

Comments
 (0)