From aaff608d0569a4c92c1bc906450061567757caef Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Thu, 2 Feb 2017 18:03:56 -0800 Subject: [PATCH] Use FlutterAppDelegate in iOS create template (#7845) On iOS, generate a FlutterAppDelegate subclass for the application delegate. This avoids touchesBegan:withEvent boilerplate to handle status bar taps. --- .../templates/create/ios.tmpl/Runner/AppDelegate.h | 5 ++--- .../templates/create/ios.tmpl/Runner/AppDelegate.m | 13 ------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.h b/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.h index a5a8b38522b..cf210d213f2 100644 --- a/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.h +++ b/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.h @@ -1,7 +1,6 @@ #import +#import -@interface AppDelegate : UIResponder - -@property (strong, nonatomic) UIWindow *window; +@interface AppDelegate : FlutterAppDelegate @end diff --git a/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.m b/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.m index 8b9b8595a3c..4b3623eb8b2 100644 --- a/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.m +++ b/packages/flutter_tools/templates/create/ios.tmpl/Runner/AppDelegate.m @@ -1,4 +1,3 @@ -#import #include "AppDelegate.h" @implementation AppDelegate @@ -30,16 +29,4 @@ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } -- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - [super touchesBegan:touches withEvent:event]; - - // Support scroll to top on status bar tap. By default, pass status bar taps - // to the application's root view controller for handling in Flutter. - UIViewController *viewController = - [UIApplication sharedApplication].keyWindow.rootViewController; - if ([viewController isKindOfClass:[FlutterViewController class]]) { - [(FlutterViewController*)viewController handleStatusBarTouches:event]; - } -} - @end