File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed
Firebase/InAppMessagingDisplay Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,13 @@ - (void)viewDidLayoutSubviews {
114
114
CGFloat maxImageViewWidth = self.view .window .frame .size .width - minimalMargine * 2 ;
115
115
CGFloat maxImageViewHeight = self.view .window .frame .size .height - minimalMargine * 2 ;
116
116
117
+ // Factor in space for the top notch on iPhone X*.
118
+ #if defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
119
+ if (@available (iOS 11.0 , *)) {
120
+ maxImageViewHeight -= self.view .safeAreaInsets .top ;
121
+ }
122
+ #endif // defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
123
+
117
124
CGFloat adjustedImageViewHeight = self.imageOriginalSize .height ;
118
125
CGFloat adjustedImageViewWidth = self.imageOriginalSize .width ;
119
126
Original file line number Diff line number Diff line change @@ -266,11 +266,21 @@ - (void)layoutFineTuneInPortraitMode {
266
266
// for tablet case, since we use a fixed card height, the reference would be just the card height
267
267
// for non-tablet case, we want to use a dynamic height , so the reference would be the window
268
268
// height
269
- CGFloat heightCalcReference =
270
- self.messageCardHeightMaxInTabletCase .active
271
- ? self.messageCardView .frame .size .height - TopBottomPaddingAroundContent * 2
272
- : self.view .window .frame .size .height - TopBottomPaddingAroundContent * 2 -
273
- TopBottomPaddingAroundMsgCard * 2 ;
269
+ CGFloat heightCalcReference = 0 ;
270
+ if (self.messageCardHeightMaxInTabletCase .active ) {
271
+ heightCalcReference =
272
+ self.messageCardView .frame .size .height - TopBottomPaddingAroundContent * 2 ;
273
+ } else {
274
+ heightCalcReference = self.view .window .frame .size .height - TopBottomPaddingAroundContent * 2 -
275
+ TopBottomPaddingAroundMsgCard * 2 ;
276
+
277
+ // Factor in space for the top notch on iPhone X*.
278
+ #if defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
279
+ if (@available (iOS 11.0 , *)) {
280
+ heightCalcReference -= self.view .safeAreaInsets .top ;
281
+ }
282
+ #endif // defined(__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
283
+ }
274
284
275
285
FIRLogDebug (kFIRLoggerInAppMessagingDisplay , @" I-FID300004" ,
276
286
@" The height calc reference is %lf "
You can’t perform that action at this time.
0 commit comments