提交 1280c527 编写于 作者: C Collin Jackson 提交者: GitHub

Make FlutterAppDelegate an empty AppDelegate (#2792)

上级 fe69b034
...@@ -9,9 +9,8 @@ ...@@ -9,9 +9,8 @@
#include "FlutterMacros.h" #include "FlutterMacros.h"
// A simple app delegate that creates a single full-screen Flutter application. // Empty implementation of UIApplicationDelegate, for simple apps
// Using FlutterAppDelegate is optional. The framework provides this interface // that don't need to customize the application delegate.
// to make it easy to get started with simple Flutter apps.
FLUTTER_EXPORT FLUTTER_EXPORT
@interface FlutterAppDelegate : UIResponder<UIApplicationDelegate> @interface FlutterAppDelegate : UIResponder<UIApplicationDelegate>
......
...@@ -3,56 +3,7 @@ ...@@ -3,56 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h" #include "sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h"
#include "sky/shell/platform/ios/framework/Headers/FlutterViewController.h"
@implementation FlutterAppDelegate @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 @end
...@@ -65,6 +65,9 @@ void FlutterInit(int argc, const char* argv[]) { ...@@ -65,6 +65,9 @@ void FlutterInit(int argc, const char* argv[]) {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) { if (self) {
if (project == nil)
_dartProject.reset([[FlutterDartProject alloc] initFromDefaultSourceForConfiguration]);
else
_dartProject.reset([project retain]); _dartProject.reset([project retain]);
[self performCommonViewControllerInitialization]; [self performCommonViewControllerInitialization];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册