From 9bc719215635d4f723e0ffb3ee78166c15d6fe92 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Thu, 3 Oct 2019 16:57:32 -0700 Subject: [PATCH] Enabled people to chose if SystemNavigator.pop is animated on iOS. (flutter/engine#12752) --- .../darwin/ios/framework/Source/FlutterPlatformPlugin.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm index 4fa0d46942..585d5a3879 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm @@ -79,7 +79,8 @@ using namespace flutter; [self setSystemChromeSystemUIOverlayStyle:args]; result(nil); } else if ([method isEqualToString:@"SystemNavigator.pop"]) { - [self popSystemNavigator]; + NSNumber* isAnimated = args; + [self popSystemNavigator:isAnimated.boolValue]; result(nil); } else if ([method isEqualToString:@"Clipboard.getData"]) { result([self getClipboardData:args]); @@ -194,7 +195,7 @@ using namespace flutter; } } -- (void)popSystemNavigator { +- (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 @@ using namespace flutter; // 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]; } else { auto engineViewController = static_cast([_engine.get() viewController]); if (engineViewController != viewController) { - [engineViewController dismissViewControllerAnimated:NO completion:nil]; + [engineViewController dismissViewControllerAnimated:isAnimated completion:nil]; } } }