From d15ee42f090a12667120c158da19c6dba3b8b171 Mon Sep 17 00:00:00 2001 From: Brian Smith <104789812+brismithers@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:37:37 -0500 Subject: [PATCH] Ensure InAppMessagesManager will capture/send impressions even if there is no IAM lifecycle listener set by the app. (#1980) * Ensure InAppMessagesManager will capture/send impressions even if there is no IAM lifecycle listener set by the app. * Flip the logic of if/else check --- .../inAppMessages/internal/InAppMessagesManager.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt b/OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt index df598f273d..ccf7381d1c 100644 --- a/OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt +++ b/OneSignalSDK/onesignal/in-app-messages/src/main/java/com/onesignal/inAppMessages/internal/InAppMessagesManager.kt @@ -526,11 +526,12 @@ internal class InAppMessagesManager( } override fun onMessageWasDisplayed(message: InAppMessage) { - if (!lifecycleCallback.hasSubscribers) { + if (lifecycleCallback.hasSubscribers) { + lifecycleCallback.fireOnMain { it.onDidDisplay(InAppMessageLifecycleEvent(message)) } + } + else { Logging.verbose("InAppMessagesManager.onMessageWasDisplayed: inAppMessageLifecycleHandler is null") - return } - lifecycleCallback.fireOnMain { it.onDidDisplay(InAppMessageLifecycleEvent(message)) } if (message.isPreview) { return