55extern " C"
66{
77
8+ bool IOSIsLowPowerModeEnabled () {
9+ return [[NSProcessInfo processInfo ] isLowPowerModeEnabled ];
10+ }
11+
812 bool IOSPermissionCameraOK () {
913
1014 NSString *mediaType = AVMediaTypeVideo;
@@ -14,8 +18,51 @@ bool IOSPermissionCameraOK() {
1418
1519 }
1620
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+
1966 }
2067
2168 bool IOSUIAccessibilityIsAssistiveTouchRunning () {
0 commit comments