-
Notifications
You must be signed in to change notification settings - Fork 56
/
AppDelegate.m
31 lines (25 loc) · 1.27 KB
/
AppDelegate.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
FlutterMethodChannel* rotationChannel = [FlutterMethodChannel
methodChannelWithName:@"zgadula/orientation"
binaryMessenger:controller];
[rotationChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
if ([@"setLandscape" isEqualToString:call.method]) {
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationLandscapeRight) forKey:@"orientation"];
}
else if ([@"setPortrait" isEqualToString:call.method]) {
[[UIDevice currentDevice] setValue:@(UIInterfaceOrientationPortrait) forKey:@"orientation"];
}
else {
result(FlutterMethodNotImplemented);
}
}];
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
@end