diff --git a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn index 097070398f..82e35d4ca6 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn @@ -24,6 +24,7 @@ shared_library("flutter_framework_dylib") { "framework/Headers/FlutterMacros.h", "framework/Headers/FlutterPlugin.h", "framework/Headers/FlutterViewController.h", + "framework/Headers/FlutterNavigationController.h", "framework/Source/FlutterAppDelegate.mm", "framework/Source/FlutterChannels.mm", "framework/Source/FlutterCodecs.mm", @@ -41,6 +42,7 @@ shared_library("flutter_framework_dylib") { "framework/Source/FlutterView.h", "framework/Source/FlutterView.mm", "framework/Source/FlutterViewController.mm", + "framework/Source/FlutterNavigationController.mm", "framework/Source/accessibility_bridge.h", "framework/Source/accessibility_bridge.mm", "framework/Source/flutter_main_ios.h", @@ -165,6 +167,7 @@ copy("framework_headers") { "framework/Headers/FlutterMacros.h", "framework/Headers/FlutterPlugin.h", "framework/Headers/FlutterViewController.h", + "framework/Headers/FlutterNavigationController.h", ] outputs = [ "$_flutter_framework_dir/Headers/{{source_file_part}}", diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/Flutter.h b/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/Flutter.h index 8501f6188b..f21d3f7075 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/Flutter.h +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/Flutter.h @@ -13,5 +13,6 @@ #include "FlutterMacros.h" #include "FlutterPlugin.h" #include "FlutterViewController.h" +#include "FlutterNavigationController.h" #endif // FLUTTER_FLUTTER_H_ diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h b/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h new file mode 100644 index 0000000000..207ab3c8b1 --- /dev/null +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h @@ -0,0 +1,9 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +@interface FlutterNavigationController: UINavigationController + +@end diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm new file mode 100644 index 0000000000..4c0fc19189 --- /dev/null +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterNavigationController.mm @@ -0,0 +1,14 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterNavigationController.h" + +@implementation FlutterNavigationController + +- (void) viewWillAppear:(BOOL)animated { + [self setNavigationBarHidden:YES]; + [super viewWillAppear:animated]; +} + +@end 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 0c216b9ae9..9fdcf63347 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 @@ -151,7 +151,13 @@ using namespace shell; } - (void)popSystemNavigator { - // Apple's human user guidelines say not to terminate iOS applications. + // 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. + UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController; + if ([viewController isKindOfClass:[UINavigationController class]]) { + [((UINavigationController*)viewController) popViewControllerAnimated:NO]; + } } - (NSDictionary*)getClipboardData:(NSString*)format {