Skip to content

Commit c4f645c

Browse files
committed
Add back dropshadow to IAMs
This was removed when supporting transparent background IAMs, but it makes banner IAMs with white backgrounds look incorrect. control the IAM dropshadow with a plist setting
1 parent 5ff232e commit c4f645c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
// Info.plist key
141141
#define FALLBACK_TO_SETTINGS_MESSAGE @"Onesignal_settings_fallback_message"
142142
#define ONESIGNAL_SUPRESS_LAUNCH_URLS @"OneSignal_suppress_launch_urls"
143+
#define ONESIGNAL_IN_APP_HIDE_DROP_SHADOW @"OneSignal_in_app_message_hide_drop_shadow"
143144

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

iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,19 @@ - (void)setupInitialMessageUI {
195195
}];
196196
}
197197

198+
- (void)updateDropShadow {
199+
// the plist value specifies whether the user wants to add drop shadow to the In App Message
200+
NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary];
201+
BOOL hideDropShadow = [bundleDict[ONESIGNAL_IN_APP_HIDE_DROP_SHADOW] boolValue];
202+
if (hideDropShadow) {
203+
return;
204+
}
205+
self.messageView.layer.shadowOffset = CGSizeMake(0, 3);
206+
self.messageView.layer.shadowColor = [[UIColor blackColor] CGColor];
207+
self.messageView.layer.shadowRadius = 3.0f;
208+
self.messageView.layer.shadowOpacity = 0.55f;
209+
}
210+
198211
- (void)displayMessage {
199212
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"Displaying In-App Message"];
200213

@@ -233,9 +246,11 @@ - (OSResultSuccessBlock)messageContentOnSuccess {
233246
if (self.waitForTags) {
234247
return;
235248
}
249+
[self updateDropShadow];
236250
[self.delegate messageWillDisplay:self.message];
237251
[self.messageView loadedHtmlContent:self.pendingHTMLContent withBaseURL:baseUrl];
238252
self.pendingHTMLContent = nil;
253+
239254
}];
240255
};
241256
}

0 commit comments

Comments
 (0)