diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/ImageUrl.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/ImageUrl.kt deleted file mode 100644 index 790d8ce..0000000 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/ImageUrl.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) SRG SSR. All rights reserved. - * License information is available from the LICENSE file. - */ -@file:Suppress("MemberVisibilityCanBePrivate") - -package ch.srg.dataProvider.integrationlayer.data - -import ch.srg.dataProvider.integrationlayer.data.serializer.ImageUrlSerializer -import java.io.Serializable - -/** - * Image url - * - * @property rawUrl Internal image url, to retrieve the url use [ImageUrl.decorated]. - */ -@Suppress("SerialVersionUIDInSerializableClass") -@kotlinx.serialization.Serializable(with = ImageUrlSerializer::class) -data class ImageUrl( - /** - * Only for internal use! Please use a Decorator! - * - * @return the undecorated url - */ - val rawUrl: String -) : Serializable { - - /** - * Decorated - * - * @param decorator The [ImageUrlDecorator] used to decorate the [rawUrl]. - * @param widthPixels The width of the image. - * @return The decorated [rawUrl]. - */ - fun decorated(decorator: ImageUrlDecorator, widthPixels: Int): String { - return decorator.decorate(rawUrl, widthPixels) - } - - @Deprecated("Using toString is not recommended in this case.", replaceWith = ReplaceWith("rawUrl")) - override fun toString(): String { - return rawUrl - } -} diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Channel.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Channel.kt index a5b6dbe..6afb709 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Channel.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Channel.kt @@ -1,6 +1,5 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -17,12 +16,12 @@ data class Channel( override val title: String, override val lead: String? = null, override val description: String? = null, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val imageFocalPoint: FocalPoint? = null, override val imageTitle: String? = null, override val imageCopyright: String? = null, override val transmission: Transmission, override val timeTableUrl: String? = null, @SerialName("imageUrlRaw") - override val rawImageUrl: ImageUrl? = null + override val rawImageUrl: String? = null ) : SRGChannelMetadata diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Chapter.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Chapter.kt index 8b31859..2a23539 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Chapter.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Chapter.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -23,7 +22,7 @@ data class Chapter( override val title: String, override val lead: String? = null, override val description: String? = null, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val imageTitle: String? = null, override val imageCopyright: String? = null, override val blockReason: BlockReason? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Episode.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Episode.kt index 9ae0fdd..8c3062d 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Episode.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Episode.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers @@ -17,7 +16,7 @@ import java.util.Date data class Episode( val id: String, override val title: String, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val lead: String? = null, override val description: String? = null, override val imageTitle: String? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Media.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Media.kt index a54525c..8986d0f 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Media.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Media.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -24,7 +23,7 @@ data class Media( override val type: Type, override val date: Date, override val duration: Long, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val imageFocalPoint: FocalPoint? = null, override val lead: String? = null, override val description: String? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/NowAndNext.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/NowAndNext.kt index e8212df..22b55d3 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/NowAndNext.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/NowAndNext.kt @@ -1,6 +1,5 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -17,15 +16,14 @@ data class NowAndNext( override val title: String, override val lead: String? = null, override val description: String? = null, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val imageFocalPoint: FocalPoint? = null, override val imageTitle: String? = null, override val imageCopyright: String? = null, override val transmission: Transmission, override val timeTableUrl: String? = null, @SerialName("imageUrlRaw") - override val rawImageUrl: ImageUrl? = null, + override val rawImageUrl: String? = null, val now: Program? = null, val next: Program? = null -) : - SRGChannelMetadata +) : SRGChannelMetadata diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Program.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Program.kt index 19c881d..fcd0483 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Program.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Program.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -21,7 +20,7 @@ data class Program( val endTime: Date, override val lead: String? = null, override val description: String? = null, - val imageUrl: ImageUrl? = null, + val imageUrl: String? = null, val imageFocalPoint: FocalPoint? = null, val imageTitle: String? = null, val imageCopyright: String? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Representation.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Representation.kt index 4514531..08eaf76 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Representation.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Representation.kt @@ -1,6 +1,5 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import kotlinx.serialization.Serializable /** @@ -31,7 +30,7 @@ data class Representation( val pickRandomElement: Boolean get() = properties?.pickRandomElement == true - val imageUrl: ImageUrl? + val imageUrl: String? get() = properties?.imageUrl val imageFocalPoint: FocalPoint? @@ -47,7 +46,7 @@ data class Representation( val label: String? = null, val hasDetailPage: Boolean? = null, val pickRandomElement: Boolean? = null, - val imageUrl: ImageUrl? = null, + val imageUrl: String? = null, val imageFocalPoint: FocalPoint? = null, val link: Link? = null, ) diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/SRGObject.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/SRGObject.kt index 88f5a0f..219a507 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/SRGObject.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/SRGObject.kt @@ -1,7 +1,5 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl - /** * Copyright (c) SRG SSR. All rights reserved. *

@@ -23,7 +21,7 @@ interface SRGMetadata { } interface SRGImageMetadata { - val imageUrl: ImageUrl + val imageUrl: String val imageTitle: String? val imageCopyright: String? val imageFocalPoint: FocalPoint? @@ -32,5 +30,5 @@ interface SRGImageMetadata { interface SRGChannelMetadata : SRGIdentifierMetadata, SRGMetadata, SRGImageMetadata { val transmission: Transmission val timeTableUrl: String? - val rawImageUrl: ImageUrl? + val rawImageUrl: String? } diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Segment.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Segment.kt index b262d51..595395d 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Segment.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Segment.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -36,7 +35,7 @@ data class Segment @JvmOverloads constructor( override val playableAbroad: Boolean, override val lead: String? = null, override val description: String? = null, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val imageFocalPoint: FocalPoint? = null, override val imageTitle: String? = null, override val imageCopyright: String? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Show.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Show.kt index 928a264..892833e 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Show.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Show.kt @@ -1,6 +1,5 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import kotlinx.serialization.Serializable /** @@ -15,7 +14,7 @@ data class Show( val transmission: Transmission, override val urn: String, override val title: String, - override val imageUrl: ImageUrl, + override val imageUrl: String, override val lead: String? = null, override val description: String? = null, val primaryChannelUrn: String? = null, @@ -23,9 +22,9 @@ data class Show( override val imageFocalPoint: FocalPoint? = null, override val imageTitle: String? = null, override val imageCopyright: String? = null, - val bannerImageUrl: ImageUrl? = null, - val posterImageUrl: ImageUrl? = null, - val podcastImageUrl: ImageUrl? = null, + val bannerImageUrl: String? = null, + val posterImageUrl: String? = null, + val podcastImageUrl: String? = null, val podcastSubscriptionUrl: String? = null, val podcastFeedSdUrl: String? = null, val podcastFeedHdUrl: String? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Song.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Song.kt index 4dd547f..e04b911 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Song.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Song.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers @@ -26,8 +25,8 @@ data class Song( @Serializable data class Cd( val name: String, - val coverUrlSmall: ImageUrl? = null, - val coverUrlLarge: ImageUrl? = null + val coverUrlSmall: String? = null, + val coverUrlLarge: String? = null ) @Serializable diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Topic.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Topic.kt index 0df79b9..c1f610b 100644 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Topic.kt +++ b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/remote/Topic.kt @@ -1,6 +1,5 @@ package ch.srg.dataProvider.integrationlayer.data.remote -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import kotlinx.serialization.Serializable /** @@ -18,7 +17,7 @@ data class Topic( override val lead: String? = null, override val description: String? = null, val viewedMedias: Int? = null, - val imageUrl: ImageUrl? = null, + val imageUrl: String? = null, val imageTitle: String? = null, val imageFocalPoint: FocalPoint? = null, val imageCopyright: String? = null, diff --git a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/serializer/ImageUrlSerializer.kt b/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/serializer/ImageUrlSerializer.kt deleted file mode 100644 index 889b3ac..0000000 --- a/data/src/main/java/ch/srg/dataProvider/integrationlayer/data/serializer/ImageUrlSerializer.kt +++ /dev/null @@ -1,21 +0,0 @@ -package ch.srg.dataProvider.integrationlayer.data.serializer - -import ch.srg.dataProvider.integrationlayer.data.ImageUrl -import kotlinx.serialization.KSerializer -import kotlinx.serialization.descriptors.PrimitiveKind -import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor -import kotlinx.serialization.encoding.Decoder -import kotlinx.serialization.encoding.Encoder - -object ImageUrlSerializer : KSerializer { - override val descriptor = PrimitiveSerialDescriptor("ImageUrl", PrimitiveKind.STRING) - - override fun deserialize(decoder: Decoder): ImageUrl { - val string = decoder.decodeString() - return ImageUrl(string) - } - - override fun serialize(encoder: Encoder, value: ImageUrl) { - encoder.encodeString(value.rawUrl) - } -} diff --git a/data/src/test/java/ch/srg/dataProvider/integrationlayer/data/TestImageUrlSerializer.kt b/data/src/test/java/ch/srg/dataProvider/integrationlayer/data/TestImageUrlSerializer.kt deleted file mode 100644 index 9d42b54..0000000 --- a/data/src/test/java/ch/srg/dataProvider/integrationlayer/data/TestImageUrlSerializer.kt +++ /dev/null @@ -1,23 +0,0 @@ -package ch.srg.dataProvider.integrationlayer.data - -import kotlinx.serialization.encodeToString -import org.junit.Assert.assertEquals -import org.junit.Test - -class TestImageUrlSerializer { - - @Test - fun testToJson() { - val expectedJson = "\"https://image.url/image.png\"" - val input = ImageUrl("https://image.url/image.png") - - assertEquals(expectedJson, DataProviderJson.encodeToString(input)) - } - - @Test - fun testFromJson() { - val inputJson = "\"https://image.url/image.png\"" - val expectedImageUrl = ImageUrl("https://image.url/image.png") - assertEquals(expectedImageUrl, DataProviderJson.decodeFromString(inputJson)) - } -} diff --git a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/image/ImageUrlExtension.kt b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/image/ImageUrlExtension.kt index 77b8ac0..001fcf9 100644 --- a/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/image/ImageUrlExtension.kt +++ b/dataprovider-retrofit/src/main/java/ch/srg/dataProvider/integrationlayer/request/image/ImageUrlExtension.kt @@ -1,29 +1,32 @@ package ch.srg.dataProvider.integrationlayer.request.image -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.data.ImageUrlDecorator import ch.srg.dataProvider.integrationlayer.request.IlHost @JvmOverloads -fun ImageUrl.decorated(widthPixels: Int, ilHost: IlHost = IlHost.PROD): String { +fun String.decorated(widthPixels: Int, ilHost: IlHost = IlHost.PROD): String { return decorated(ImageUrlDecoratorInstances.getOrCreate(ilHost), widthPixels) } @JvmOverloads -fun ImageUrl.decorated(width: ImageWidth, ilHost: IlHost = IlHost.PROD): String { +fun String.decorated(width: ImageWidth, ilHost: IlHost = IlHost.PROD): String { return decorated(widthPixels = width.widthPixels, ilHost = ilHost) } @JvmOverloads -fun ImageUrl.decorated(imageSize: ImageSize, ilHost: IlHost = IlHost.PROD): String { +fun String.decorated(imageSize: ImageSize, ilHost: IlHost = IlHost.PROD): String { return decorated(width = imageSize.width, ilHost = ilHost) } -fun ImageUrl.decorated(decorator: ImageUrlDecorator, width: ImageWidth): String { +fun String.decorated(decorator: ImageUrlDecorator, widthPixels: Int): String { + return decorator.decorate(this, widthPixels) +} + +fun String.decorated(decorator: ImageUrlDecorator, width: ImageWidth): String { return decorated(decorator, width.widthPixels) } -fun ImageUrl.decorated(decorator: ImageUrlDecorator, imageSize: ImageSize): String { +fun String.decorated(decorator: ImageUrlDecorator, imageSize: ImageSize): String { return decorated(decorator, imageSize.width) } diff --git a/dataprovider-retrofit/src/test/java/ch/srg/dataProvider/integrationlayer/TestDefaultImageUrlDecorator.kt b/dataprovider-retrofit/src/test/java/ch/srg/dataProvider/integrationlayer/TestDefaultImageUrlDecorator.kt index a3d5912..a02ac79 100644 --- a/dataprovider-retrofit/src/test/java/ch/srg/dataProvider/integrationlayer/TestDefaultImageUrlDecorator.kt +++ b/dataprovider-retrofit/src/test/java/ch/srg/dataProvider/integrationlayer/TestDefaultImageUrlDecorator.kt @@ -2,7 +2,6 @@ package ch.srg.dataProvider.integrationlayer import android.net.Uri import androidx.test.ext.junit.runners.AndroidJUnit4 -import ch.srg.dataProvider.integrationlayer.data.ImageUrl import ch.srg.dataProvider.integrationlayer.request.IlHost import ch.srg.dataProvider.integrationlayer.request.image.DefaultImageUrlDecorator import ch.srg.dataProvider.integrationlayer.request.image.ImageSize @@ -19,56 +18,56 @@ class TestDefaultImageUrlDecorator { @Test fun testPixelValid() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=480" assertEquals(expected, input.decorated(decorator, 480)) } @Test fun testPixelWidthInvalid() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=480" assertEquals(expected, input.decorated(decorator, 460)) } @Test fun testImageSize() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=480" assertEquals(expected, input.decorated(decorator, ImageSize.MEDIUM)) } @Test fun testImageWidth() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=1920" assertEquals(expected, input.decorated(decorator, ImageWidth.W1920)) } @Test fun testOtherIlHost() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il-stage.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=1920" assertEquals(expected, input.decorated(decorator = DefaultImageUrlDecorator(IlHost.STAGE), width = ImageWidth.W1920)) } @Test fun testExtensionImageWidthWithIlHost() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il-stage.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=1920" assertEquals(expected, input.decorated(ilHost = IlHost.STAGE, width = ImageWidth.W1920)) } @Test fun testExtensionImageSizeWithIlHost() { - val input = ImageUrl("https://ws.srf.ch/asset/image/audio/123") - val encodedInput = Uri.encode("https://ws.srf.ch/asset/image/audio/123") + val input = "https://ws.srf.ch/asset/image/audio/123" + val encodedInput = Uri.encode(input) val expected = "https://il-test.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=480" assertEquals(expected, input.decorated(ilHost = IlHost.TEST, imageSize = ImageSize.MEDIUM)) } @@ -87,17 +86,15 @@ class TestDefaultImageUrlDecorator { "https://swi-services-ch/asset/image/audio/123", ) for (url in tests) { - val input = ImageUrl(url) val encodedInput = Uri.encode(url) val expected = "https://il-test.srgssr.ch/images/?imageUrl=${encodedInput}&format=webp&width=480" - assertEquals(expected, input.decorated(ilHost = IlHost.TEST, imageSize = ImageSize.MEDIUM)) + assertEquals(expected, url.decorated(ilHost = IlHost.TEST, imageSize = ImageSize.MEDIUM)) } } @Test fun testInvalidHostNameUrlReturnInputUrl() { - val input = ImageUrl("https://akamai.playsuisse.ch/asset/image/audio/123") - val expected = input.rawUrl - assertEquals(expected, input.decorated(ilHost = IlHost.TEST, imageSize = ImageSize.MEDIUM)) + val input = "https://akamai.playsuisse.ch/asset/image/audio/123" + assertEquals(input, input.decorated(ilHost = IlHost.TEST, imageSize = ImageSize.MEDIUM)) } }