From 60fba52521f211782e27f2efae161e0c3bd4cb95 Mon Sep 17 00:00:00 2001 From: Danmei Chen Date: Tue, 9 Jul 2019 17:38:32 +0200 Subject: [PATCH] fix status bar height in call view for iphoneX, XR and XS --- Classes/LinphoneUI/UICompositeView.m | 6 +----- Classes/PhoneMainView.h | 1 + Classes/PhoneMainView.m | 6 +++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Classes/LinphoneUI/UICompositeView.m b/Classes/LinphoneUI/UICompositeView.m index 0c31cbc2e..621f4730e 100644 --- a/Classes/LinphoneUI/UICompositeView.m +++ b/Classes/LinphoneUI/UICompositeView.m @@ -392,10 +392,6 @@ return UIInterfaceOrientationPortrait; } -#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) -#define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height >= 812.0) -#define IPHONE_STATUSBAR_HEIGHT (IS_IPHONE_X ? 35 : 20) - - (void)update:(UICompositeViewDescription *)description tabBar:(NSNumber *)tabBar statusBar:(NSNumber *)statusBar @@ -577,7 +573,7 @@ // Compute frame for each elements CGRect viewFrame = self.view.frame; - int origin = currentViewDescription.fullscreen ? 0 : IPHONE_STATUSBAR_HEIGHT; + int origin = currentViewDescription.fullscreen ? 0 : [PhoneMainView iphoneStatusBarHeight]; // 1. status bar - fixed size on top diff --git a/Classes/PhoneMainView.h b/Classes/PhoneMainView.h index f62080ccd..305780c11 100644 --- a/Classes/PhoneMainView.h +++ b/Classes/PhoneMainView.h @@ -119,6 +119,7 @@ + (PhoneMainView*) instance; - (BOOL)isIphoneXDevice; ++ (int)iphoneStatusBarHeight; @end diff --git a/Classes/PhoneMainView.m b/Classes/PhoneMainView.m index 0415465fd..415f486b2 100644 --- a/Classes/PhoneMainView.m +++ b/Classes/PhoneMainView.m @@ -208,13 +208,17 @@ static RootViewManager *rootViewManagerInstance = nil; /* IPHONE X specific : hide the HomeIndcator when not used */ #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) -#define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height == 812.0) +#define IS_IPHONE_X (IS_IPHONE && [[UIScreen mainScreen] bounds].size.height >= 812.0) #define IPHONE_STATUSBAR_HEIGHT (IS_IPHONE_X ? 35 : 20) - (BOOL)isIphoneXDevice{ return IS_IPHONE_X; } ++ (int)iphoneStatusBarHeight{ + return IPHONE_STATUSBAR_HEIGHT; +} + - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; if([self isIphoneXDevice]){