Skip to content

Commit

Permalink
Make FlutterAppDelegate an empty AppDelegate (flutter#2792)
Browse files Browse the repository at this point in the history
  • Loading branch information
collinjackson authored Jul 13, 2016
1 parent fe69b03 commit 1280c52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 53 deletions.
5 changes: 2 additions & 3 deletions sky/shell/platform/ios/framework/Headers/FlutterAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<UIApplicationDelegate>

Expand Down
49 changes: 0 additions & 49 deletions sky/shell/platform/ios/framework/Source/FlutterAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ - (instancetype)initWithProject:(FlutterDartProject*)project
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];
}
Expand Down

0 comments on commit 1280c52

Please sign in to comment.