Skip to content

Commit

Permalink
Merge pull request #1396 from OneSignal/feat/override_gray_overlay
Browse files Browse the repository at this point in the history
[User Model] Add plist option to override gray overlay to In App Messages
  • Loading branch information
nan-li committed Apr 15, 2024
2 parents 472249f + f559d43 commit 3a732d6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
#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"
#define ONESIGNAL_IN_APP_HIDE_GRAY_OVERLAY @"OneSignal_in_app_message_hide_gray_overlay"

// GDPR Privacy Consent
#define GDPR_CONSENT_GRANTED @"GDPR_CONSENT_GRANTED"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,17 @@ - (void)setupInitialMessageUI {
// Only the center modal and full screen (both centered) IAM should have a dark background
// So get the alpha based on the IAM being a banner or not
double alphaBackground = [self.message isBanner] ? 0.0 : 0.5;
[UIView animateWithDuration:0.3 animations:^{

// the plist value specifies whether the user wants to add a gray overlay to the In App Message
NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary];
BOOL hideGrayOverlay = [bundleDict[ONESIGNAL_IN_APP_HIDE_GRAY_OVERLAY] boolValue];
if (hideGrayOverlay) {
self.view.backgroundColor = [UIColor clearColor];
} else {
self.view.backgroundColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:alphaBackground];
}

[UIView animateWithDuration:0.3 animations:^{
self.view.alpha = 1.0;
} completion:^(BOOL finished) {
if (!finished)
Expand Down

0 comments on commit 3a732d6

Please sign in to comment.