5
5
extern " C"
6
6
{
7
7
8
+ bool IOSIsLowPowerModeEnabled () {
9
+ return [[NSProcessInfo processInfo ] isLowPowerModeEnabled ];
10
+ }
11
+
8
12
bool IOSPermissionCameraOK () {
9
13
10
14
NSString *mediaType = AVMediaTypeVideo;
@@ -14,8 +18,51 @@ bool IOSPermissionCameraOK() {
14
18
15
19
}
16
20
17
- bool IOSIsLowPowerModeEnabled () {
18
- return [[NSProcessInfo processInfo ] isLowPowerModeEnabled ];
21
+ float IOSSafeAreaInsets (const char * side) {
22
+
23
+ if (@available (iOS 11.0 , *)) {
24
+
25
+ const NSString * sideString = [NSString stringWithUTF8String: side];
26
+
27
+ UIWindow *window = UIApplication.sharedApplication .keyWindow ;
28
+
29
+ if ([sideString isEqualToString: @" top" ]) {
30
+
31
+ return window.safeAreaInsets .top ;
32
+
33
+ } else if ([sideString isEqualToString: @" left" ]) {
34
+
35
+ return window.safeAreaInsets .left ;
36
+
37
+ } else if ([sideString isEqualToString: @" right" ]) {
38
+
39
+ return window.safeAreaInsets .right ;
40
+
41
+ } else if ([sideString isEqualToString: @" bottom" ]) {
42
+
43
+ return window.safeAreaInsets .bottom ;
44
+
45
+ } else {
46
+
47
+ NSException * exception = [NSException
48
+ exceptionWithName: NSInvalidArgumentException
49
+ reason: @" Invalid side value."
50
+ userInfo: nil ];
51
+
52
+ [exception raise ];
53
+
54
+ }
55
+ }
56
+
57
+ NSException * exception = [NSException
58
+ exceptionWithName: NSInvalidArgumentException
59
+ reason: @" SafeArea only avalible on iOS 11+"
60
+ userInfo: nil ];
61
+
62
+ [exception raise ];
63
+
64
+ return false ;
65
+
19
66
}
20
67
21
68
bool IOSUIAccessibilityIsAssistiveTouchRunning () {
0 commit comments