Skip to content

Commit 5370474

Browse files
hrishileanplume7mac
authored andcommitted
Rich interstiail orientation fix (#330)
1 parent 3ed08f4 commit 5370474

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Leanplum-SDK/Classes/LPMessageTemplates.m

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ @implementation LPMessageTemplatesClass {
179179
UIButton *_overlayView;
180180
LPHitView *_closePopupView;
181181
BOOL _webViewNeedsFade;
182+
UIDeviceOrientation _orientation;
182183
}
183184

184185
#pragma mark Initialization
@@ -739,13 +740,20 @@ - (void)setupPopupLayout:(BOOL)isFullscreen isPushAskToAsk:(BOOL)isPushAskToAsk
739740

740741
- (void)orientationDidChange:(NSNotification *)notification
741742
{
742-
[self updatePopupLayout];
743-
744-
// isStatusBarHidden is not updated synchronously
745-
LPActionContext *conteext = _contexts.lastObject;
746-
if ([conteext.actionName isEqualToString:LPMT_INTERSTITIAL_NAME]) {
747-
[self performSelector:@selector(updatePopupLayout) withObject:nil afterDelay:0];
743+
UIDevice *device = notification.object;
744+
// Bug with iOS, calls orientation did change even without change,
745+
// Check if the orientation is not changed than before.
746+
if (_orientation != device.orientation) {
747+
_orientation = device.orientation;
748+
[self updatePopupLayout];
749+
750+
// isStatusBarHidden is not updated synchronously
751+
LPActionContext *conteext = _contexts.lastObject;
752+
if ([conteext.actionName isEqualToString:LPMT_INTERSTITIAL_NAME]) {
753+
[self performSelector:@selector(updatePopupLayout) withObject:nil afterDelay:0];
754+
}
748755
}
756+
749757
}
750758

751759
- (void)closePopupWithAnimation:(BOOL)animated

0 commit comments

Comments
 (0)