Coverage Summary for Class: InAppActionHandler (cloud.mindbox.mobile_sdk.inapp.presentation.actions)
| Class |
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| InAppActionHandler |
50%
(2/4)
|
100%
(2/2)
|
77.8%
(7/9)
|
57.9%
(33/57)
|
| InAppActionHandler$handle$1 |
0%
(0/1)
|
|
0%
(0/2)
|
0%
(0/10)
|
| Total |
40%
(2/5)
|
100%
(2/2)
|
63.6%
(7/11)
|
49.3%
(33/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
)
}
}
}