I am new to jetpack compose and I found a way to add a gif to my app using coil but a lot of the code I found seem outdated and not working anymore and I can't find any other useful information . I don't know what to do to make it work.
I found this code on GitHub:
@ExperimentalCoilApi
@Composable
fun MessageContents(
message: Message,
modifier: Modifier = Modifier
) {
...
val context = LocalContext.current
val imageLoader = ImageLoader.Builder(context)
.componentRegistry {
if (SDK_INT >= 28) {
add(ImageDecoderDecoder(context))
} else {
add(GifDecoder())
}
}
.build()
Image(
painter = rememberImagePainter(
imageLoader = imageLoader,
data = it.image,
builder = {
size(OriginalSize)
}
),
contentDescription = null,
modifier = Modifier
.padding(top = paddingTop)
)
...