diff --git a/sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h b/sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h index 4ed81437a54dfc0c5928c2054d7be7113fcd47a5..693185e66e117d726461f6fe5b24c08929e246e7 100644 --- a/sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h +++ b/sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h @@ -9,9 +9,8 @@ #include "FlutterMacros.h" -// A simple app delegate that creates a single full-screen Flutter application. -// Using FlutterAppDelegate is optional. The framework provides this interface -// to make it easy to get started with simple Flutter apps. +// Empty implementation of UIApplicationDelegate, for simple apps +// that don't need to customize the application delegate. FLUTTER_EXPORT @interface FlutterAppDelegate : UIResponder diff --git a/sky/shell/platform/ios/framework/Source/FlutterAppDelegate.mm b/sky/shell/platform/ios/framework/Source/FlutterAppDelegate.mm index 0966841a68c47a908e56fbadca15d064eee8b30f..686bb8ca2d2f5fc5f3e176bda4b066535fc42ce1 100644 --- a/sky/shell/platform/ios/framework/Source/FlutterAppDelegate.mm +++ b/sky/shell/platform/ios/framework/Source/FlutterAppDelegate.mm @@ -3,56 +3,7 @@ // found in the LICENSE file. #include "sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h" -#include "sky/shell/platform/ios/framework/Headers/FlutterViewController.h" @implementation FlutterAppDelegate -- (BOOL)application:(UIApplication*)application - didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { - FlutterDartProject* project = - [[FlutterDartProject alloc] initFromDefaultSourceForConfiguration]; - - CGRect frame = [UIScreen mainScreen].bounds; - UIWindow* window = [[UIWindow alloc] initWithFrame:frame]; - FlutterViewController* viewController = - [[FlutterViewController alloc] initWithProject:project - nibName:nil - bundle:nil]; - [project release]; - window.rootViewController = viewController; - [viewController release]; - self.window = window; - [window release]; - [self.window makeKeyAndVisible]; - - return YES; -} - -// Use the NSNotificationCenter to notify services when we're opened with URLs. -// TODO(jackson): Revisit this API once we have more services using URLs to make -// it more typed and less brittle -- (BOOL)application:(UIApplication*)app - openURL:(NSURL*)url - sourceApplication:(NSString*)sourceApplication - annotation:(id)annotation { - - NSDictionary* dict = [@{ - @"handled" : [NSMutableDictionary dictionary], - @"url" : url, - @"sourceApplication" : sourceApplication, - } mutableCopy]; - - if (annotation != nil) - [dict setValue:annotation forKey:@"annotation"]; - - [[NSNotificationCenter defaultCenter] postNotificationName:@"openURL" - object:self - userInfo:dict]; - - BOOL handled = ((NSNumber*)dict[@"handled"][@"value"]).boolValue; - [dict release]; - - return handled; -} - @end diff --git a/sky/shell/platform/ios/framework/Source/FlutterViewController.mm b/sky/shell/platform/ios/framework/Source/FlutterViewController.mm index 6b4897212d6f504b86b24929e776297a59f9603c..086e091ab55c418d1078f8ac3c311f162609992d 100644 --- a/sky/shell/platform/ios/framework/Source/FlutterViewController.mm +++ b/sky/shell/platform/ios/framework/Source/FlutterViewController.mm @@ -65,7 +65,10 @@ void FlutterInit(int argc, const char* argv[]) { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { - _dartProject.reset([project retain]); + if (project == nil) + _dartProject.reset([[FlutterDartProject alloc] initFromDefaultSourceForConfiguration]); + else + _dartProject.reset([project retain]); [self performCommonViewControllerInitialization]; }