From c4d149133b568a033963738062fe911a8b7f7864 Mon Sep 17 00:00:00 2001 From: sarbagyastha Date: Sat, 9 Jan 2021 13:12:43 +0545 Subject: [PATCH 1/6] set path along with query as initialRoute --- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 1e574aec6343d..ebd4ccfd5127b 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -158,8 +158,15 @@ - (BOOL)application:(UIApplication*)application FML_LOG(ERROR) << "Timeout waiting for the first frame when launching an URL."; } else { + NSString *pathAndQuery = @""; + if ([url.path length] != 0) { + 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; From 48587a944e9c4ea530e1beb7b503153416eff2c2 Mon Sep 17 00:00:00 2001 From: sarbagyastha Date: Sat, 9 Jan 2021 13:16:40 +0545 Subject: [PATCH 2/6] updated launch url test --- .../darwin/ios/framework/Source/FlutterAppDelegateTest.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm index 5e3fd48371912..aa29d42ea6905 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegateTest.mm @@ -29,7 +29,7 @@ - (void)testLaunchUrl { 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 @@ -38,7 +38,7 @@ - (void)testLaunchUrl { return @{@"FlutterDeepLinkingEnabled" : @(YES)}; }]; XCTAssertTrue(result); - OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:url.path]); + OCMVerify([navigationChannel invokeMethod:@"pushRoute" arguments:@"/custom/route?query=test"]); } @end From 00244300d4f86842b93bc4a55484078da7f2144b Mon Sep 17 00:00:00 2001 From: sarbagyastha Date: Sat, 9 Jan 2021 13:51:25 +0545 Subject: [PATCH 3/6] fixed formatting --- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index ebd4ccfd5127b..6e8447681e6dc 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -158,11 +158,12 @@ - (BOOL)application:(UIApplication*)application FML_LOG(ERROR) << "Timeout waiting for the first frame when launching an URL."; } else { - NSString *pathAndQuery = @""; + NSString* pathAndQuery = @""; if ([url.path length] != 0) { pathAndQuery = url.path; if ([url.query length] != 0) { - pathAndQuery = [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; + pathAndQuery = + [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; } } [flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute" From 678d1e4e2f70aeef0f631afc7502eb9b26f889a0 Mon Sep 17 00:00:00 2001 From: sarbagyastha Date: Sat, 9 Jan 2021 20:29:24 +0545 Subject: [PATCH 4/6] removed unneccesary check --- .../darwin/ios/framework/Source/FlutterAppDelegate.mm | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 6e8447681e6dc..2549d594242c2 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -158,13 +158,9 @@ - (BOOL)application:(UIApplication*)application FML_LOG(ERROR) << "Timeout waiting for the first frame when launching an URL."; } else { - NSString* pathAndQuery = @""; - if ([url.path length] != 0) { - pathAndQuery = url.path; - if ([url.query length] != 0) { - pathAndQuery = - [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; - } + NSString* pathAndQuery = url.path; + if ([url.query length] != 0) { + pathAndQuery = [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; } [flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute" arguments:pathAndQuery]; From 432beae97cbbc3175b4082012582611e383a8ea7 Mon Sep 17 00:00:00 2001 From: sarbagyastha Date: Sat, 9 Jan 2021 20:47:59 +0545 Subject: [PATCH 5/6] formatting fix --- .../platform/darwin/ios/framework/Source/FlutterAppDelegate.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 2549d594242c2..8eec2cc4ae436 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -160,7 +160,8 @@ - (BOOL)application:(UIApplication*)application } else { NSString* pathAndQuery = url.path; if ([url.query length] != 0) { - pathAndQuery = [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; + pathAndQuery = + [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; } [flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute" arguments:pathAndQuery]; From 640d5f8167eeeb8062f1d89ec4188dbdbae30dd3 Mon Sep 17 00:00:00 2001 From: Sarbagya Dhaubanjar Date: Sat, 9 Jan 2021 21:11:59 +0545 Subject: [PATCH 6/6] minor formatting fix --- .../platform/darwin/ios/framework/Source/FlutterAppDelegate.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm index 8eec2cc4ae436..2eb7b4da1c75d 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterAppDelegate.mm @@ -160,7 +160,7 @@ - (BOOL)application:(UIApplication*)application } else { NSString* pathAndQuery = url.path; if ([url.query length] != 0) { - pathAndQuery = + pathAndQuery = [NSString stringWithFormat:@"%@?%@", pathAndQuery, url.query]; } [flutterViewController.engine.navigationChannel invokeMethod:@"pushRoute"