Skip to content

Commit

Permalink
Extract width definition in a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Nov 16, 2023
1 parent bb7a4b7 commit 4c938bf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ch.srg.dataProvider.integrationlayer.data.IlImage
import ch.srgssr.pillarbox.core.business.images.DefaultImageScalingService
import ch.srgssr.pillarbox.core.business.images.ImageScalingService
import ch.srgssr.pillarbox.core.business.images.ImageScalingService.ImageFormat
import ch.srgssr.pillarbox.core.business.images.ImageScalingService.ImageWidth
import ch.srgssr.pillarbox.demo.shared.ui.integrationLayer.data.Content
import ch.srgssr.pillarbox.demo.shared.ui.integrationLayer.data.ILRepository
import kotlinx.coroutines.flow.Flow
Expand Down Expand Up @@ -98,10 +99,11 @@ class ContentListViewModel(
format: ImageFormat = ImageFormat.WEBP
): String {
val size = IlImage.Size.getClosest(containerWidth)
val width = enumValueOf<ImageWidth>(size.name)

return imageScalingService.getScaledImageUrl(
imageUrl = imageUrl,
width = enumValueOf(size.name),
width = width,
format = format
)
}
Expand Down

0 comments on commit 4c938bf

Please sign in to comment.