Skip to content

Commit 472249f

Browse files
authored
Merge pull request #1395 from OneSignal/dropshadow_fix
[User Model] Add back the dropshadow to In App Messages with a plist option to disable it
2 parents b3b2a8b + c4f645c commit 472249f

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
@@ -200,6 +200,19 @@ - (void)setupInitialMessageUI {
200200
}];
201201
}
202202

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

@@ -238,9 +251,11 @@ - (OSResultSuccessBlock)messageContentOnSuccess {
238251
if (self.waitForTags) {
239252
return;
240253
}
254+
[self updateDropShadow];
241255
[self.delegate messageWillDisplay:self.message];
242256
[self.messageView loadedHtmlContent:self.pendingHTMLContent withBaseURL:baseUrl];
243257
self.pendingHTMLContent = nil;
258+
244259
}];
245260
};
246261
}

0 commit comments

Comments
 (0)