From 879b4969a48d6ba34c04e4249a405a8c8ac168ab Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 2 Oct 2019 13:18:04 -0700 Subject: [PATCH 1/2] Enabled people to chose if SystemNavigator.pop is animated on iOS. --- .../darwin/ios/framework/Source/FlutterPlatformPlugin.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 4fa0d46942854..698ac2a8dbc38 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -79,7 +79,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [self setSystemChromeSystemUIOverlayStyle:args]; result(nil); } else if ([method isEqualToString:@"SystemNavigator.pop"]) { - [self popSystemNavigator]; + [self popSystemNavigator:args]; result(nil); } else if ([method isEqualToString:@"Clipboard.getData"]) { result([self getClipboardData:args]); @@ -194,7 +194,7 @@ - (void)setSystemChromeSystemUIOverlayStyle:(NSDictionary*)message { } } -- (void)popSystemNavigator { +- (void)popSystemNavigator:(NSNumber*)isAnimated { // Apple's human user guidelines say not to terminate iOS applications. However, if the // root view of the app is a navigation controller, it is instructed to back up a level // in the navigation hierarchy. @@ -202,11 +202,11 @@ - (void)popSystemNavigator { // outside the context of a UINavigationController, and still wants to be popped. UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController; if ([viewController isKindOfClass:[UINavigationController class]]) { - [((UINavigationController*)viewController) popViewControllerAnimated:NO]; + [((UINavigationController*)viewController) popViewControllerAnimated:isAnimated.boolValue]; } else { auto engineViewController = static_cast([_engine.get() viewController]); if (engineViewController != viewController) { - [engineViewController dismissViewControllerAnimated:NO completion:nil]; + [engineViewController dismissViewControllerAnimated:isAnimated.boolValue completion:nil]; } } } From 01cef4090f5b9ef974a60fd3073248b789ba1067 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 2 Oct 2019 16:17:28 -0700 Subject: [PATCH 2/2] responded to chinmay's feedback --- .../darwin/ios/framework/Source/FlutterPlatformPlugin.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 698ac2a8dbc38..585d5a3879356 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -79,7 +79,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [self setSystemChromeSystemUIOverlayStyle:args]; result(nil); } else if ([method isEqualToString:@"SystemNavigator.pop"]) { - [self popSystemNavigator:args]; + NSNumber* isAnimated = args; + [self popSystemNavigator:isAnimated.boolValue]; result(nil); } else if ([method isEqualToString:@"Clipboard.getData"]) { result([self getClipboardData:args]); @@ -194,7 +195,7 @@ - (void)setSystemChromeSystemUIOverlayStyle:(NSDictionary*)message { } } -- (void)popSystemNavigator:(NSNumber*)isAnimated { +- (void)popSystemNavigator:(BOOL)isAnimated { // Apple's human user guidelines say not to terminate iOS applications. However, if the // root view of the app is a navigation controller, it is instructed to back up a level // in the navigation hierarchy. @@ -202,11 +203,11 @@ - (void)popSystemNavigator:(NSNumber*)isAnimated { // outside the context of a UINavigationController, and still wants to be popped. UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController; if ([viewController isKindOfClass:[UINavigationController class]]) { - [((UINavigationController*)viewController) popViewControllerAnimated:isAnimated.boolValue]; + [((UINavigationController*)viewController) popViewControllerAnimated:isAnimated]; } else { auto engineViewController = static_cast([_engine.get() viewController]); if (engineViewController != viewController) { - [engineViewController dismissViewControllerAnimated:isAnimated.boolValue completion:nil]; + [engineViewController dismissViewControllerAnimated:isAnimated completion:nil]; } } }