Skip to content

Commit

Permalink
Add back dropshadow to IAMs
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emawby committed Apr 4, 2024
1 parent 5ff232e commit c4f645c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
// Info.plist key
#define FALLBACK_TO_SETTINGS_MESSAGE @"Onesignal_settings_fallback_message"
#define ONESIGNAL_SUPRESS_LAUNCH_URLS @"OneSignal_suppress_launch_urls"
#define ONESIGNAL_IN_APP_HIDE_DROP_SHADOW @"OneSignal_in_app_message_hide_drop_shadow"

// GDPR Privacy Consent
#define GDPR_CONSENT_GRANTED @"GDPR_CONSENT_GRANTED"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ - (void)setupInitialMessageUI {
}];
}

- (void)updateDropShadow {
// the plist value specifies whether the user wants to add drop shadow to the In App Message
NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary];
BOOL hideDropShadow = [bundleDict[ONESIGNAL_IN_APP_HIDE_DROP_SHADOW] boolValue];
if (hideDropShadow) {
return;
}
self.messageView.layer.shadowOffset = CGSizeMake(0, 3);
self.messageView.layer.shadowColor = [[UIColor blackColor] CGColor];
self.messageView.layer.shadowRadius = 3.0f;
self.messageView.layer.shadowOpacity = 0.55f;
}

- (void)displayMessage {
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"Displaying In-App Message"];

Expand Down Expand Up @@ -233,9 +246,11 @@ - (OSResultSuccessBlock)messageContentOnSuccess {
if (self.waitForTags) {
return;
}
[self updateDropShadow];
[self.delegate messageWillDisplay:self.message];
[self.messageView loadedHtmlContent:self.pendingHTMLContent withBaseURL:baseUrl];
self.pendingHTMLContent = nil;

}];
};
}
Expand Down

0 comments on commit c4f645c

Please sign in to comment.