-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoUtility.m
57 lines (42 loc) · 1.44 KB
/
DemoUtility.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// DemoUtility.m
// DJISimulatorDemo
//
// Created by DJI on 8/6/2016.
// Copyright © 2016 DJI. All rights reserved.
//
#import "DemoUtility.h"
#import <DJISDK/DJISDK.h>
@implementation DemoUtility
+(DJIBaseProduct*) fetchProduct {
return [DJISDKManager product];
}
+(DJIAircraft*) fetchAircraft {
if (![DJISDKManager product]) {
return nil;
}
if ([[DJISDKManager product] isKindOfClass:[DJIAircraft class]]) {
return ((DJIAircraft*)[DJISDKManager product]);
}
return nil;
}
+(DJIFlightController*) fetchFlightController {
if (![DJISDKManager product]) {
return nil;
}
if ([[DJISDKManager product] isKindOfClass:[DJIAircraft class]]) {
return ((DJIAircraft*)[DJISDKManager product]).flightController;
}
return nil;
}
+ (void)showAlertViewWithTitle:(NSString *)title message:(NSString *)message cancelAlertAction:(UIAlertAction*)cancelAlert defaultAlertAction:(UIAlertAction*)defaultAlert viewController:(UIViewController *)viewController{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
if (cancelAlert) {
[alertController addAction:cancelAlert];
}
if (defaultAlert) {
[alertController addAction: defaultAlert];
}
[viewController presentViewController:alertController animated:YES completion:nil];
}
@end