diff --git a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m index c1c25bc1..7d6f6e8d 100644 --- a/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m +++ b/doric-iOS/Pod/Classes/Engine/DoricJSEngine.m @@ -68,6 +68,7 @@ - (instancetype)init { @"screenWidth": @([[UIScreen mainScreen] bounds].size.width), @"screenHeight": @([[UIScreen mainScreen] bounds].size.height), @"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height), + @"hasNotch": @(hasNotch()), @"deviceBrand": @"Apple", @"deviceModel": platform, }; diff --git a/doric-iOS/Pod/Classes/Util/DoricUtil.h b/doric-iOS/Pod/Classes/Util/DoricUtil.h index e04430d2..4cc81175 100644 --- a/doric-iOS/Pod/Classes/Util/DoricUtil.h +++ b/doric-iOS/Pod/Classes/Util/DoricUtil.h @@ -42,3 +42,5 @@ NSBundle *_Nonnull DoricBundle(void); void ShowToast(NSString *_Nonnull text, DoricGravity gravity); UIImage *_Nonnull UIImageWithColor(UIColor *_Nonnull color); + +BOOL hasNotch(void); diff --git a/doric-iOS/Pod/Classes/Util/DoricUtil.m b/doric-iOS/Pod/Classes/Util/DoricUtil.m index a84eec6c..e6e8653a 100644 --- a/doric-iOS/Pod/Classes/Util/DoricUtil.m +++ b/doric-iOS/Pod/Classes/Util/DoricUtil.m @@ -95,3 +95,12 @@ void ShowToast(NSString *text, DoricGravity gravity) { UIGraphicsEndImageContext(); return image; } + +BOOL hasNotch() { + if (@available(iOS 11.0, *)) { + CGFloat height = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom; + return (height > 0); + } else { + return NO; + } +}