Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support for large in-app messages #456

Merged
merged 8 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions messaginginapp/api/messaginginapp.api
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,10 @@ public final class io/customer/messaginginapp/state/InAppMessagingAction$SetUser
public fun toString ()Ljava/lang/String;
}

public final class io/customer/messaginginapp/state/InAppMessagingActionKt {
public static final fun shouldMarkMessageAsShown (Lio/customer/messaginginapp/state/InAppMessagingAction;)Z
}

public final class io/customer/messaginginapp/state/InAppMessagingManager {
public fun <init> ()V
public fun <init> (Lio/customer/messaginginapp/gist/presentation/GistListener;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DEV {
override fun getGistQueueApiUrl() = "https://gist-queue-consumer-api.cloud.dev.gist.build"
override fun getEngineApiUrl() = "https://engine.api.dev.gist.build"
override fun getGistRendererUrl() = "https://renderer.gist.build/2.0"
override fun getGistRendererUrl() = "https://renderer.gist.build/beta"

Check warning on line 13 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/GistEnvironment.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/GistEnvironment.kt#L13

Added line #L13 was not covered by tests
mrehan27 marked this conversation as resolved.
Show resolved Hide resolved
},

LOCAL {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
fun setup(message: Message) {
logger.debug("GistView setup: $message")
currentMessage = message
currentMessage?.let { message ->

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / API check

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / API check

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / Unit tests (messaginginapp)

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / Snapshot build and publish

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

Name shadowed: message

Check warning on line 55 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

Name shadowed: message
val engineWebConfiguration = EngineWebConfiguration(
siteId = store.siteId,
dataCenter = store.dataCenter,
Expand Down Expand Up @@ -116,12 +116,16 @@
try {
shouldLogAction = false
logger.debug("Dismissing from system action: $action")
inAppMessagingManager.dispatch(InAppMessagingAction.DismissMessage(message = message, shouldLog = false))
val intent = Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse(action)
intent.flags =
Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
startActivity(context, intent, null)

// launch system action first otherwise there is a possibility
// that due to lifecycle change and message still being in queue to be displayed
// the message will be displayed again, putting GistActivity before the system action in stack
inAppMessagingManager.dispatch(InAppMessagingAction.DismissMessage(message = message, shouldLog = false))

Check warning on line 128 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/GistView.kt#L128

Added line #L128 was not covered by tests
mrehan27 marked this conversation as resolved.
Show resolved Hide resolved
} catch (e: ActivityNotFoundException) {
logger.debug("System action not handled: $action")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.graphics.Color
import android.net.http.SslError
import android.util.AttributeSet
import android.util.Base64
import android.webkit.SslErrorHandler
import android.webkit.WebResourceError
import android.webkit.WebResourceRequest
Expand All @@ -23,7 +22,6 @@
import io.customer.messaginginapp.gist.utilities.ElapsedTimer
import io.customer.messaginginapp.state.InAppMessagingState
import io.customer.sdk.core.di.SDKComponent
import java.io.UnsupportedEncodingException
import java.util.Timer
import java.util.TimerTask

Expand Down Expand Up @@ -77,83 +75,75 @@
@SuppressLint("SetJavaScriptEnabled")
fun setup(configuration: EngineWebConfiguration) {
setupTimeout()
val jsonString = Gson().toJson(configuration)
encodeToBase64(jsonString)?.let { options ->
elapsedTimer.start("Engine render for message: ${configuration.messageId}")
val messageUrl =
"${state.environment.getGistRendererUrl()}/index.html?options=$options"
logger.debug("Rendering message with URL: $messageUrl")
webView?.let {
it.loadUrl(messageUrl)
it.settings.javaScriptEnabled = true
it.settings.allowFileAccess = true
it.settings.allowContentAccess = true
it.settings.domStorageEnabled = true
it.settings.textZoom = 100
it.setBackgroundColor(Color.TRANSPARENT)

findViewTreeLifecycleOwner()?.lifecycle?.addObserver(this) ?: run {
logger.error("Lifecycle owner not found, attaching interface to WebView manually")
engineWebViewInterface.attach(webView = it)
}
elapsedTimer.start("Engine render for message: ${configuration.messageId}")
val messageData = mapOf("options" to configuration)
val jsonString = Gson().toJson(messageData)
val messageUrl =
"${state.environment.getGistRendererUrl()}/index.html"
logger.debug("Rendering message with URL: $messageUrl")

Check warning on line 83 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L78-L83

Added lines #L78 - L83 were not covered by tests
webView?.let {
it.settings.javaScriptEnabled = true
it.settings.allowFileAccess = true
it.settings.allowContentAccess = true
it.settings.domStorageEnabled = true
it.settings.textZoom = 100
it.setBackgroundColor(Color.TRANSPARENT)

Check warning on line 90 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L85-L90

Added lines #L85 - L90 were not covered by tests

findViewTreeLifecycleOwner()?.lifecycle?.addObserver(this) ?: run {
logger.error("Lifecycle owner not found, attaching interface to WebView manually")
engineWebViewInterface.attach(webView = it)
}

Check warning on line 95 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L93-L95

Added lines #L93 - L95 were not covered by tests

it.webViewClient = object : WebViewClient() {
override fun onPageFinished(view: WebView, url: String?) {
view.loadUrl("javascript:window.parent.postMessage = function(message) {window.${EngineWebViewInterface.JAVASCRIPT_INTERFACE_NAME}.postMessage(JSON.stringify(message))}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is what's breaking the bridge

it.webViewClient = object : WebViewClient() {

Check warning on line 97 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L97

Added line #L97 was not covered by tests
override fun onPageFinished(view: WebView, url: String?) {
val script = """
window.postMessage($jsonString, '*');
""".trim()
mrehan27 marked this conversation as resolved.
Show resolved Hide resolved
view.evaluateJavascript(script) { result ->
logger.debug("JavaScript execution result: $result")

Check warning on line 103 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L99-L103

Added lines #L99 - L103 were not covered by tests
}
}

Check warning on line 105 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 105 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L105

Added line #L105 was not covered by tests

override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
return !url.startsWith("https://code.gist.build")
}
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / API check

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / API check

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Unit tests (messaginginapp)

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Snapshot build and publish

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 107 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details
return !url.startsWith("https://code.gist.build")
}

Check warning on line 109 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

override fun onReceivedError(
view: WebView?,
errorCod: Int,
description: String,
failingUrl: String?
) {
listener?.error()
}
override fun onReceivedError(

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / API check

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / API check

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Android Lint (messaginginapp)

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Unit tests (messaginginapp)

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Snapshot build and publish

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details

Check warning on line 111 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View workflow job for this annotation

GitHub Actions / Generate Comparison Report

This declaration overrides deprecated member but not marked as deprecated itself. This deprecation won't be inherited in future releases. Please add @deprecated annotation or suppress. See https://youtrack.jetbrains.com/issue/KT-47902 for details
view: WebView?,
errorCod: Int,
description: String,
failingUrl: String?
) {
listener?.error()
}

Check warning on line 118 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L118

Added line #L118 was not covered by tests

override fun onReceivedHttpError(
view: WebView?,
request: WebResourceRequest?,
errorResponse: WebResourceResponse?
) {
listener?.error()
}
override fun onReceivedHttpError(
view: WebView?,
request: WebResourceRequest?,
errorResponse: WebResourceResponse?
) {
listener?.error()
}

Check warning on line 126 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L126

Added line #L126 was not covered by tests

override fun onReceivedError(
view: WebView?,
request: WebResourceRequest?,
error: WebResourceError?
) {
listener?.error()
}
override fun onReceivedError(
view: WebView?,
request: WebResourceRequest?,
error: WebResourceError?
) {
listener?.error()
}

Check warning on line 134 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L134

Added line #L134 was not covered by tests

override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler?,
error: SslError?
) {
listener?.error()
}
override fun onReceivedSslError(
view: WebView?,
handler: SslErrorHandler?,
error: SslError?
) {
listener?.error()
}
}
} ?: run {
listener?.error()
}
}

private fun encodeToBase64(text: String): String? {
val data: ByteArray?
try {
data = text.toByteArray(charset("UTF-8"))
} catch (ex: UnsupportedEncodingException) {
logger.debug("Unsupported encoding exception")
return null
it.loadUrl(messageUrl)

Check warning on line 145 in messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/gist/presentation/engine/EngineWebView.kt#L145

Added line #L145 was not covered by tests
}
return Base64.encodeToString(data, Base64.URL_SAFE)
}

private fun setupTimeout() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,39 @@

is InAppMessagingAction.ProcessMessageQueue -> state.copy(messagesInQueue = action.messages.toSet())
is InAppMessagingAction.SetPollingInterval -> state.copy(pollInterval = action.interval)
is InAppMessagingAction.DismissMessage -> state.copy(currentMessageState = MessageState.Dismissed(action.message))
is InAppMessagingAction.EngineAction.MessageLoadingFailed -> state.copy(currentMessageState = MessageState.Dismissed(action.message))
is InAppMessagingAction.LoadMessage -> state.copy(currentMessageState = MessageState.Loading(action.message))
is InAppMessagingAction.Reset -> InAppMessagingState(siteId = state.siteId, dataCenter = state.dataCenter, environment = state.environment)
is InAppMessagingAction.DisplayMessage -> {
action.message.queueId?.let { queueId ->
// If the message should be tracked shown when it is displayed, add the queueId to shownMessageQueueIds.
val shownMessageQueueIds = if (action.shouldMarkMessageAsShown()) {
state.shownMessageQueueIds + queueId
} else {
state.shownMessageQueueIds

Check warning on line 24 in messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessageReducer.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessageReducer.kt#L24

Added line #L24 was not covered by tests
}

state.copy(
currentMessageState = MessageState.Displayed(action.message),
shownMessageQueueIds = state.shownMessageQueueIds + queueId,
shownMessageQueueIds = shownMessageQueueIds,
messagesInQueue = state.messagesInQueue.filterNot { it.queueId == queueId }.toSet()
)
} ?: state
}

is InAppMessagingAction.DismissMessage -> {
var shownMessageQueueIds = state.shownMessageQueueIds
// If the message should be tracked shown when it is dismissed, add the queueId to shownMessageQueueIds.
if (action.shouldMarkMessageAsShown() && action.message.queueId != null) {
shownMessageQueueIds = shownMessageQueueIds + action.message.queueId
}

Check warning on line 40 in messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessageReducer.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessageReducer.kt#L39-L40

Added lines #L39 - L40 were not covered by tests

state.copy(
currentMessageState = MessageState.Dismissed(action.message),
shownMessageQueueIds = shownMessageQueueIds
)
}

else -> state
}
val changes = state.diff(newState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,19 @@ sealed class InAppMessagingAction {
object ClearMessageQueue : InAppMessagingAction()
object Reset : InAppMessagingAction()
}

fun InAppMessagingAction.shouldMarkMessageAsShown(): Boolean {
return when (this) {
is InAppMessagingAction.DisplayMessage -> {
// Mark the message as shown if it's not persistent
!message.gistProperties.persistent
}

is InAppMessagingAction.DismissMessage -> {
// Mark the message as shown if it's persistent and should be logged and dismissed via close action only
message.gistProperties.persistent && shouldLog && viaCloseAction
}

else -> false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,23 @@
}

private fun handleMessageDismissal(action: InAppMessagingAction.DismissMessage, next: (Any) -> Any) {
if (action.shouldLog) {
if (action.viaCloseAction) {
SDKComponent.gistQueue.logView(action.message)
}
// Log message close only if message should be tracked as shown on dismiss action
if (action.shouldMarkMessageAsShown()) {
SDKComponent.logger.debug("Persistent message dismissed, logging view for message: ${action.message}, shouldLog: ${action.shouldLog}, viaCloseAction: ${action.viaCloseAction}")
SDKComponent.gistQueue.logView(action.message)

Check warning on line 51 in messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessagingMiddlewares.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessagingMiddlewares.kt#L50-L51

Added lines #L50 - L51 were not covered by tests
} else {
SDKComponent.logger.debug("Message dismissed, not logging view for message: ${action.message}, shouldLog: ${action.shouldLog}, viaCloseAction: ${action.viaCloseAction}")
}
next(action)
}

private fun handleMessageDisplay(action: InAppMessagingAction.DisplayMessage, next: (Any) -> Any) {
val gistProperties = action.message.gistProperties
if (!gistProperties.persistent) {
// Log message view only if message should be tracked as shown on display action
if (action.shouldMarkMessageAsShown()) {
SDKComponent.logger.debug("Message shown, logging view for message: ${action.message}")
SDKComponent.gistQueue.logView(action.message)
} else {
SDKComponent.logger.debug("Persistent message shown, not logging view for message: ${action.message}")

Check warning on line 64 in messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessagingMiddlewares.kt

View check run for this annotation

Codecov / codecov/patch

messaginginapp/src/main/java/io/customer/messaginginapp/state/InAppMessagingMiddlewares.kt#L64

Added line #L64 was not covered by tests
}
next(action)
}
Expand Down
Loading