From 52e5aebff7ca58d3df2b4b404cf96340cd61e07f Mon Sep 17 00:00:00 2001 From: Sarbagya Dhaubanjar Date: Fri, 22 Jan 2021 04:54:01 +0545 Subject: [PATCH] iOS deeplink sends "path + query" instead of just path (flutter/engine#23562) --- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 7 ++++++- .../darwin/ios/framework/Source/FlutterAppDelegateTest.mm | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 72fa8344f64..472a6e8b1fd 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -159,8 +159,13 @@ static BOOL IsDeepLinkingEnabled(NSDictionary* infoDictionary) { 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; diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm index abbfafc919c..6a62697dbfe 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm @@ -30,7 +30,7 @@ FLUTTER_ASSERT_ARC appDelegate.rootFlutterViewControllerGetter = ^{ return viewController; }; - NSURL* url = [NSURL URLWithString:@"http://example.com"]; + NSURL* url = [NSURL URLWithString:@"http://myApp/custom/route?query=test"]; NSDictionary* options = @{}; BOOL result = [appDelegate application:[UIApplication sharedApplication] openURL:url @@ -39,7 +39,7 @@ FLUTTER_ASSERT_ARC return @{@"FlutterDeepLinkingEnabled" : @(YES)}; }]; XCTAssertTrue(result); - OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:url.path]); + OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]); } @end