Coverage Summary for Class: InAppActionHandler (cloud.mindbox.mobile_sdk.inapp.presentation.actions)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| InAppActionHandler |
75%
(3/4)
|
100%
(2/2)
|
88.9%
(8/9)
|
66.7%
(38/57)
|
| InAppActionHandler$handle$1 |
0%
(0/1)
|
|
0%
(0/2)
|
0%
(0/10)
|
| Total |
60%
(3/5)
|
100%
(2/2)
|
72.7%
(8/11)
|
56.7%
(38/67)
|
package cloud.mindbox.mobile_sdk.inapp.presentation.actions
import cloud.mindbox.mobile_sdk.inapp.domain.models.Layer
import cloud.mindbox.mobile_sdk.inapp.presentation.MindboxView
import cloud.mindbox.mobile_sdk.utils.LoggingExceptionHandler
internal class InAppActionHandler {
var mindboxView: MindboxView? = null
fun handle(
actionLayer: Layer.ImageLayer.Action,
mindboxView: MindboxView?
): InAppActionResult =
LoggingExceptionHandler.runCatching(InAppActionResult("", "", true)) {
val action = createAction(layerAction = actionLayer)
action.execute(mindboxView = mindboxView)
}
private fun createAction(
layerAction: Layer.ImageLayer.Action,
): InAppAction =
when (layerAction) {
is Layer.ImageLayer.Action.RedirectUrlAction ->
RedirectUrlInAppAction(url = layerAction.url, payload = layerAction.payload)
is Layer.ImageLayer.Action.PushPermissionAction -> {
PushPermissionInAppAction(
payload = layerAction.payload
)
}
}
}