Skip to content

Commit 9f491c6

Browse files
LP-9953: iPhone X Interstitial and Web Insterstitial layout fixes (#240)
Merging the Interstatial issue.
1 parent 9e254af commit 9f491c6

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

Leanplum-SDK/Classes/LPMessageTemplates.m

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,14 +1023,17 @@ - (void)updatePopupLayout
10231023
[self updateNonWebPopupLayout:statusBarHeight];
10241024
_overlayView.frame = CGRectMake(0, 0, screenWidth, screenHeight);
10251025
}
1026-
1026+
1027+
UIEdgeInsets safeAreaInsets = [self safeAreaInsets];
1028+
CGFloat leftSafeAreaX = safeAreaInsets.left;
10271029
CGFloat dismissButtonX = screenWidth - _dismissButton.frame.size.width - LPMT_ACCEPT_BUTTON_MARGIN / 2;
10281030
CGFloat dismissButtonY = statusBarHeight + LPMT_ACCEPT_BUTTON_MARGIN / 2;
10291031
if (!fullscreen) {
10301032
dismissButtonX = _popupView.frame.origin.x + _popupView.frame.size.width - 3 * _dismissButton.frame.size.width / 4;
10311033
dismissButtonY = _popupView.frame.origin.y - _dismissButton.frame.size.height / 4;
10321034
}
1033-
_dismissButton.frame = CGRectMake(dismissButtonX, dismissButtonY, _dismissButton.frame.size.width,
1035+
1036+
_dismissButton.frame = CGRectMake(dismissButtonX - leftSafeAreaX, dismissButtonY, _dismissButton.frame.size.width,
10341037
_dismissButton.frame.size.height);
10351038
}
10361039

@@ -1092,20 +1095,10 @@ - (void)updateHtmlLayoutWithContext:(LPActionContext *)context
10921095
_popupGroup.frame = CGRectMake(htmlX, htmlY, htmlWidth, htmlHeight);
10931096

10941097
} else if (isIPhoneX) {
1095-
// Do not offset the bottom safe area (control panel) on landscape.
1096-
// Safe area is present on left and right on landscape.
1097-
CGFloat leftSafeAreaHeight = safeAreaInsets.left;
1098-
#if LP_NOT_TV
1099-
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
1100-
if (orientation == UIInterfaceOrientationLandscapeRight ||
1101-
orientation == UIInterfaceOrientationLandscapeLeft) {
1102-
bottomSafeAreaHeight = 0;
1103-
leftSafeAreaHeight += safeAreaInsets.right;
1104-
}
1105-
#endif
1106-
_popupGroup.frame = CGRectMake(-leftSafeAreaHeight, -safeAreaInsets.top,
1107-
screenWidth+safeAreaInsets.left+safeAreaInsets.right,
1108-
screenHeight+safeAreaInsets.top+bottomSafeAreaHeight);
1098+
_popupGroup.frame = CGRectMake(safeAreaInsets.left, safeAreaInsets.top,
1099+
screenWidth - safeAreaInsets.left - safeAreaInsets.right,
1100+
screenHeight - safeAreaInsets.top - bottomSafeAreaHeight);
1101+
11091102
NSLog( @"%@", NSStringFromCGRect(_popupGroup.frame) );
11101103
NSLog(@"%f, %f", screenWidth, screenHeight);
11111104
NSLog(@"%@", NSStringFromUIEdgeInsets(safeAreaInsets));

0 commit comments

Comments
 (0)