Coverage Summary for Class: ApplyDefaultStrategyKt (cloud.mindbox.mobile_sdk.pushes.handler.image)
| Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
| ApplyDefaultStrategyKt |
0%
(0/1)
|
0%
(0/1)
|
|
0%
(0/2)
|
0%
(0/7)
|
package cloud.mindbox.mobile_sdk.pushes.handler.image
import android.content.Context
import android.graphics.Bitmap
import cloud.mindbox.mobile_sdk.pushes.MindboxRemoteMessage
import cloud.mindbox.mobile_sdk.pushes.handler.MessageHandlingState
/**
* The strategy applies the passed [defaultImage] if loading failed
*
* @param defaultImage Optional image
*/
public fun MindboxImageFailureHandler.Companion.applyDefaultStrategy(
defaultImage: Bitmap? = null,
): MindboxImageFailureHandler = ApplyDefaultStrategyImpl(defaultImage = defaultImage)
internal class ApplyDefaultStrategyImpl(
private val defaultImage: Bitmap? = null,
) : MindboxImageFailureHandler {
override fun onImageLoadingFailed(
context: Context,
message: MindboxRemoteMessage,
state: MessageHandlingState,
error: Throwable,
): ImageRetryStrategy = ImageRetryStrategy.ApplyDefault(defaultImage = defaultImage)
}