Skip to content

Commit b218b01

Browse files
authored
Merge pull request #2187 from OneSignal/fix/keyboard_input_IAM
Fix Keyboard input in HTML In App Messagess
2 parents 78264aa + 8697cb7 commit b218b01

File tree

1 file changed

+8
-5
lines changed
  • OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/display/impl

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ internal class InAppMessageView(
104104

105105
fun setWebView(webView: WebView) {
106106
this.webView = webView
107-
this.webView!!.setBackgroundColor(Color.TRANSPARENT)
107+
this.webView?.setBackgroundColor(Color.TRANSPARENT)
108108
}
109109

110110
fun setMessageController(messageController: InAppMessageViewListener?) {
@@ -277,10 +277,13 @@ internal class InAppMessageView(
277277
if (hasBackground) WindowManager.LayoutParams.MATCH_PARENT else WindowManager.LayoutParams.WRAP_CONTENT,
278278
false,
279279
)
280-
popupWindow!!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
281-
popupWindow!!.isTouchable = true
280+
popupWindow?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
281+
popupWindow?.isTouchable = true
282+
// Focusable allows keyboard input for HTML IAMs, but also prevents interacting under banners
283+
popupWindow?.isFocusable = !displayPosition.isBanner
284+
282285
// NOTE: This is required for getting fullscreen under notches working in portrait mode
283-
popupWindow!!.isClippingEnabled = false
286+
popupWindow?.isClippingEnabled = false
284287
var gravity = 0
285288
if (!hasBackground) {
286289
gravity =
@@ -299,7 +302,7 @@ internal class InAppMessageView(
299302
popupWindow!!,
300303
displayType,
301304
)
302-
popupWindow!!.showAtLocation(
305+
popupWindow?.showAtLocation(
303306
currentActivity!!.window.decorView.rootView,
304307
gravity,
305308
0,

0 commit comments

Comments
 (0)