Skip to content

Commit 3a732d6

Browse files
authored
Merge pull request #1396 from OneSignal/feat/override_gray_overlay
[User Model] Add plist option to override gray overlay to In App Messages
2 parents 472249f + f559d43 commit 3a732d6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
#define FALLBACK_TO_SETTINGS_MESSAGE @"Onesignal_settings_fallback_message"
142142
#define ONESIGNAL_SUPRESS_LAUNCH_URLS @"OneSignal_suppress_launch_urls"
143143
#define ONESIGNAL_IN_APP_HIDE_DROP_SHADOW @"OneSignal_in_app_message_hide_drop_shadow"
144+
#define ONESIGNAL_IN_APP_HIDE_GRAY_OVERLAY @"OneSignal_in_app_message_hide_gray_overlay"
144145

145146
// GDPR Privacy Consent
146147
#define GDPR_CONSENT_GRANTED @"GDPR_CONSENT_GRANTED"

iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,17 @@ - (void)setupInitialMessageUI {
189189
// Only the center modal and full screen (both centered) IAM should have a dark background
190190
// So get the alpha based on the IAM being a banner or not
191191
double alphaBackground = [self.message isBanner] ? 0.0 : 0.5;
192-
[UIView animateWithDuration:0.3 animations:^{
192+
193+
// the plist value specifies whether the user wants to add a gray overlay to the In App Message
194+
NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary];
195+
BOOL hideGrayOverlay = [bundleDict[ONESIGNAL_IN_APP_HIDE_GRAY_OVERLAY] boolValue];
196+
if (hideGrayOverlay) {
197+
self.view.backgroundColor = [UIColor clearColor];
198+
} else {
193199
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:alphaBackground];
200+
}
201+
202+
[UIView animateWithDuration:0.3 animations:^{
194203
self.view.alpha = 1.0;
195204
} completion:^(BOOL finished) {
196205
if (!finished)

0 commit comments

Comments
 (0)