Skip to content

Commit 3524165

Browse files
committed
Add override for IAM gray overlay
1 parent dd9430d commit 3524165

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/display/impl/InAppMessageView.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ internal class InAppMessageView(
4949
private var webView: WebView?,
5050
private val messageContent: InAppMessageContent,
5151
private val disableDragDismiss: Boolean,
52+
private val hideGrayOverlay: Boolean,
5253
) {
5354
private var popupWindow: PopupWindow? = null
5455

@@ -611,13 +612,19 @@ internal class InAppMessageView(
611612
cardViewAnimCallback,
612613
)
613614

615+
var overlayColor = Color.parseColor("#BB000000")
616+
617+
if (hideGrayOverlay) {
618+
overlayColor = Color.TRANSPARENT
619+
}
620+
614621
// Animate background behind the message so it doesn't just show the dark transparency
615622
val backgroundAnimation =
616623
animateBackgroundColor(
617624
backgroundView,
618625
IN_APP_BACKGROUND_ANIMATION_DURATION_MS,
619626
ACTIVITY_BACKGROUND_COLOR_EMPTY,
620-
ACTIVITY_BACKGROUND_COLOR_FULL,
627+
overlayColor,
621628
backgroundAnimCallback,
622629
)
623630
messageAnimation.start()
@@ -634,11 +641,17 @@ internal class InAppMessageView(
634641
}
635642
}
636643

644+
var overlayColor = Color.parseColor("#BB000000")
645+
646+
if (hideGrayOverlay) {
647+
overlayColor = Color.TRANSPARENT
648+
}
649+
637650
// Animate background behind the message so it hides before being removed from the view
638651
animateBackgroundColor(
639652
backgroundView,
640653
IN_APP_BACKGROUND_ANIMATION_DURATION_MS,
641-
ACTIVITY_BACKGROUND_COLOR_FULL,
654+
overlayColor,
642655
ACTIVITY_BACKGROUND_COLOR_EMPTY,
643656
animCallback,
644657
)
@@ -681,7 +694,6 @@ internal class InAppMessageView(
681694
companion object {
682695
private const val IN_APP_MESSAGE_CARD_VIEW_TAG = "IN_APP_MESSAGE_CARD_VIEW_TAG"
683696
private val ACTIVITY_BACKGROUND_COLOR_EMPTY = Color.parseColor("#00000000")
684-
private val ACTIVITY_BACKGROUND_COLOR_FULL = Color.parseColor("#BB000000")
685697
private const val IN_APP_BANNER_ANIMATION_DURATION_MS = 1000
686698
private const val IN_APP_CENTER_ANIMATION_DURATION_MS = 1000
687699
private const val IN_APP_BACKGROUND_ANIMATION_DURATION_MS = 400

OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/display/impl/WebViewManager.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import android.os.Build
77
import android.view.View
88
import android.webkit.JavascriptInterface
99
import android.webkit.WebView
10+
import com.onesignal.common.AndroidUtils
1011
import com.onesignal.common.ViewUtils
1112
import com.onesignal.common.safeString
1213
import com.onesignal.common.threading.suspendifyOnMain
@@ -359,7 +360,8 @@ internal class WebViewManager(
359360

360361
fun createNewInAppMessageView(dragToDismissDisabled: Boolean) {
361362
lastPageHeight = messageContent.pageHeight
362-
val newView = InAppMessageView(webView!!, messageContent, dragToDismissDisabled)
363+
val hideGrayOverlay = AndroidUtils.getManifestMetaBoolean(_applicationService.appContext, "com.onesignal.inAppMessageHideGrayOverlay")
364+
val newView = InAppMessageView(webView!!, messageContent, dragToDismissDisabled, hideGrayOverlay)
363365
setMessageView(newView)
364366
val self = this
365367
messageView!!.setMessageController(

0 commit comments

Comments
 (0)