From f559d4396b4e52f01cba32e9b88d13857b9d8654 Mon Sep 17 00:00:00 2001 From: Jenna Antilla <46546946+jennantilla@users.noreply.github.com> Date: Thu, 4 Apr 2024 16:48:41 -0700 Subject: [PATCH] Add override for IAM gray overlay --- .../OneSignalCore/Source/OneSignalCommonDefines.h | 1 + .../UI/OSInAppMessageViewController.m | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h index 4777b759f..21f1208fe 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h +++ b/iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalCommonDefines.h @@ -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" diff --git a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m index ab94af9a1..69999975e 100644 --- a/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m +++ b/iOS_SDK/OneSignalSDK/OneSignalInAppMessages/UI/OSInAppMessageViewController.m @@ -184,8 +184,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)