Skip to content

Commit e363725

Browse files
authored
fix safe area while displaying rich interstitial message (#352)
* fix safe area while displaying rich interstitial message * move fix to base html message template * add fix to be applyed only when message is displayed on full screen
1 parent 2600913 commit e363725

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Leanplum-SDK/Classes/Features/Actions/LPActionContext.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ - (NSURL *)htmlWithTemplateNamed:(NSString *)templateName
293293
LPLog(LPError, @"Fail to get HTML template.");
294294
return nil;
295295
}
296+
297+
if ([[htmlVars valueForKey:@"Height"] isEqualToString:@"100%"] && [[htmlVars valueForKey:@"Width"] isEqualToString:@"100%"]) {
298+
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"/*##MEDIAQUERY##" withString:@""];
299+
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"##MEDIAQUERY##*/" withString:@""];
300+
}
301+
296302
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"##Vars##"
297303
withString:jsonString];
298304

Leanplum-SDK/Classes/MessageTemplates/LPBaseHtmlMessageTemplate.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ - (void)updateHtmlLayoutWithContext:(LPActionContext *)context
307307
safeAreaInsets.left = 0;
308308
safeAreaInsets.right = 0;
309309
bottomSafeAreaHeight = 0;
310+
} else {
311+
safeAreaInsets.top = 0;
312+
safeAreaInsets.bottom = 0;
313+
bottomSafeAreaHeight = 0;
310314
}
311315

312316
self.popupGroup.frame = CGRectMake(safeAreaInsets.left, safeAreaInsets.top,

Leanplum-SDK/Classes/MessageTemplates/LPBaseInterstitialMessageTemplate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
2121
@property (nonatomic, strong) UIButton *cancelButton;
2222
@property (nonatomic, strong) UILabel *titleLabel;
2323
@property (nonatomic, strong) UILabel *messageLabel;
24-
@property (nonatomic, strong) UIButton *overlayView;;
24+
@property (nonatomic, strong) UIButton *overlayView;
2525
@property (nonatomic, strong) LPHitView *closePopupView;
2626
@property (nonatomic, assign) UIDeviceOrientation orientation;
2727

0 commit comments

Comments
 (0)