diff --git a/app/src/main/kotlin/com/wire/android/model/ImageAsset.kt b/app/src/main/kotlin/com/wire/android/model/ImageAsset.kt index e29e95f159c..358345a8865 100644 --- a/app/src/main/kotlin/com/wire/android/model/ImageAsset.kt +++ b/app/src/main/kotlin/com/wire/android/model/ImageAsset.kt @@ -30,35 +30,43 @@ import com.wire.kalium.logic.data.user.UserAssetId import okio.Path @Stable -sealed class ImageAsset(private val imageLoader: WireSessionImageLoader) { - /** - * Value that uniquely identifies this Asset, - * can be used for caching purposes, for example. - */ - abstract val uniqueKey: String - - @Stable - data class UserAvatarAsset( - private val imageLoader: WireSessionImageLoader, - val userAssetId: UserAssetId - ) : ImageAsset(imageLoader) { - override val uniqueKey: String - get() = userAssetId.toString() - } +sealed class ImageAsset { /** * Represents an image asset that is stored locally on the device, and it isn't necessarily bounded to any specific conversation or * message, i.e. some preview images that the user selected from local device gallery. */ @Stable - data class LocalImageAsset( - private val imageLoader: WireSessionImageLoader, + data class Local( val dataPath: Path, val idKey: String - ) : ImageAsset(imageLoader) { + ) : ImageAsset() + sealed class Remote(private val imageLoader: WireSessionImageLoader) : ImageAsset() { + + /** + * Value that uniquely identifies this Asset, + * can be used for caching purposes, for example. + */ + abstract val uniqueKey: String + + @Composable + fun paint( + fallbackData: Any? = null, + withCrossfadeAnimation: Boolean = false + ) = when { + LocalInspectionMode.current -> painterResource(id = R.drawable.ic_welcome_1) + else -> imageLoader.paint(asset = this, fallbackData = fallbackData, withCrossfadeAnimation = withCrossfadeAnimation) + } + } + + @Stable + data class UserAvatarAsset( + private val imageLoader: WireSessionImageLoader, + val userAssetId: UserAssetId + ) : Remote(imageLoader) { override val uniqueKey: String - get() = idKey + get() = userAssetId.toString() } @Stable @@ -68,20 +76,11 @@ sealed class ImageAsset(private val imageLoader: WireSessionImageLoader) { val messageId: String, val isSelfAsset: Boolean, val isEphemeral: Boolean = false - ) : ImageAsset(imageLoader) { + ) : Remote(imageLoader) { override fun toString(): String = "$conversationId:$messageId:$isSelfAsset:$isEphemeral" override val uniqueKey: String get() = toString() } - - @Composable - fun paint( - fallbackData: Any? = null, - withCrossfadeAnimation: Boolean = false - ) = when { - LocalInspectionMode.current -> painterResource(id = R.drawable.ic_welcome_1) - else -> imageLoader.paint(asset = this, fallbackData = fallbackData, withCrossfadeAnimation = withCrossfadeAnimation) - } } fun String.parseIntoPrivateImageAsset( diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt index d85e719fdfd..07bc1be625c 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/MessageTypes.kt @@ -174,14 +174,14 @@ fun MessageImage( transferStatus: AssetTransferStatus, onImageClick: Clickable, shouldFillMaxWidth: Boolean = false, - isImportedMediaAsset: Boolean = false ) { Box( Modifier .padding(top = MaterialTheme.wireDimensions.spacing4x) .clip(shape = RoundedCornerShape(dimensions().messageAssetBorderRadius)) .background( - color = MaterialTheme.wireColorScheme.onPrimary, shape = RoundedCornerShape(dimensions().messageAssetBorderRadius) + color = MaterialTheme.wireColorScheme.onPrimary, + shape = RoundedCornerShape(dimensions().messageAssetBorderRadius) ) .border( width = dimensions().spacing1x, @@ -212,9 +212,9 @@ fun MessageImage( ) } - asset != null -> { - if (isImportedMediaAsset) ImportedImageMessage(asset, shouldFillMaxWidth) - else DisplayableImageMessage(asset, imgParams.normalizedWidth, imgParams.normalizedHeight) + asset != null -> when (asset) { + is ImageAsset.Local -> ImportedImageMessage(asset, shouldFillMaxWidth) + is ImageAsset.Remote -> DisplayableImageMessage(asset, imgParams.normalizedWidth, imgParams.normalizedHeight) } // Show error placeholder @@ -230,7 +230,7 @@ fun MessageImage( @Composable fun MediaAssetImage( - asset: ImageAsset?, + asset: ImageAsset.Remote?, width: Dp, height: Dp, transferStatus: AssetTransferStatus?, diff --git a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/image/ImageMessageTypes.kt b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/image/ImageMessageTypes.kt index 76b0802e085..97cb3b9d837 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/image/ImageMessageTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/conversations/model/messagetypes/image/ImageMessageTypes.kt @@ -40,6 +40,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp +import coil.compose.AsyncImage import coil.compose.SubcomposeAsyncImage import com.wire.android.R import com.wire.android.model.ImageAsset @@ -52,7 +53,7 @@ import okio.Path @Composable fun DisplayableImageMessage( - imageData: ImageAsset, + imageData: ImageAsset.Remote, width: Dp, height: Dp, modifier: Modifier = Modifier @@ -82,8 +83,10 @@ fun AsyncImageMessage( .width(width) .height(height), loading = { _ -> - Box(modifier = Modifier.size(MaterialTheme.wireDimensions.spacing24x), - contentAlignment = Alignment.Center) { + Box( + modifier = Modifier.size(MaterialTheme.wireDimensions.spacing24x), + contentAlignment = Alignment.Center + ) { WireCircularProgressIndicator( progressColor = MaterialTheme.wireColorScheme.primary, modifier = Modifier.padding(dimensions().spacing24x) @@ -97,12 +100,12 @@ fun AsyncImageMessage( @Composable fun ImportedImageMessage( - imageData: ImageAsset, + imageData: ImageAsset.Local, shouldFillMaxWidth: Boolean, modifier: Modifier = Modifier ) { - Image( - painter = imageData.paint(), + AsyncImage( + model = imageData.dataPath.toFile(), contentDescription = stringResource(R.string.content_description_image_message), modifier = if (!shouldFillMaxWidth) modifier .width(dimensions().importedMediaAssetSize) @@ -165,15 +168,15 @@ fun ImageMessageFailed(width: Dp, height: Dp, isDownloadFailure: Boolean) { tint = MaterialTheme.colorScheme.error, modifier = Modifier ) - Spacer(modifier = Modifier.height(MaterialTheme.wireDimensions.spacing8x)) - Text( - text = stringResource( - id = if (isDownloadFailure) R.string.error_downloading_image_message - else R.string.error_uploading_image_message - ), - textAlign = TextAlign.Center, - style = MaterialTheme.wireTypography.subline01.copy(color = MaterialTheme.wireColorScheme.error) - ) - } + Spacer(modifier = Modifier.height(MaterialTheme.wireDimensions.spacing8x)) + Text( + text = stringResource( + id = if (isDownloadFailure) R.string.error_downloading_image_message + else R.string.error_uploading_image_message + ), + textAlign = TextAlign.Center, + style = MaterialTheme.wireTypography.subline01.copy(color = MaterialTheme.wireColorScheme.error) + ) + } } } diff --git a/app/src/main/kotlin/com/wire/android/ui/home/gallery/ZoomableImage.kt b/app/src/main/kotlin/com/wire/android/ui/home/gallery/ZoomableImage.kt index b6579e51475..13c2f1400c2 100644 --- a/app/src/main/kotlin/com/wire/android/ui/home/gallery/ZoomableImage.kt +++ b/app/src/main/kotlin/com/wire/android/ui/home/gallery/ZoomableImage.kt @@ -33,10 +33,9 @@ import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.layout.ContentScale import com.wire.android.model.ImageAsset -import com.wire.android.util.ui.WireSessionImageLoader @Composable -fun ZoomableImage(imageAsset: ImageAsset, contentDescription: String, imageScale: Float = 1.0f) { +fun ZoomableImage(imageAsset: ImageAsset.Remote, contentDescription: String, imageScale: Float = 1.0f) { var offsetX by remember { mutableStateOf(0f) } var offsetY by remember { mutableStateOf(0f) } var zoom by remember { mutableStateOf(1f) } @@ -47,7 +46,8 @@ fun ZoomableImage(imageAsset: ImageAsset, contentDescription: String, imageScale Image( painter = imageAsset.paint(), contentDescription = contentDescription, - modifier = Modifier.align(Alignment.Center) + modifier = Modifier + .align(Alignment.Center) .graphicsLayer( scaleX = zoom, scaleY = zoom, diff --git a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaAuthenticatedViewModel.kt b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaAuthenticatedViewModel.kt index b8318707aa7..37e4e48047d 100644 --- a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaAuthenticatedViewModel.kt +++ b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaAuthenticatedViewModel.kt @@ -65,6 +65,9 @@ import com.wire.kalium.logic.feature.selfDeletingMessages.ObserveSelfDeletionTim import com.wire.kalium.logic.feature.selfDeletingMessages.PersistNewSelfDeletionTimerUseCase import com.wire.kalium.logic.feature.user.GetSelfUserUseCase import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.collections.immutable.PersistentList +import kotlinx.collections.immutable.persistentListOf +import kotlinx.collections.immutable.toPersistentList import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.Job @@ -303,7 +306,7 @@ class ImportMediaAuthenticatedViewModel @Inject constructor( ImportMediaSnackbarMessages.MaxAssetSizeExceeded(importedAsset.assetSizeExceeded!!) ) } - importMediaState = importMediaState.copy(importedAssets = mutableListOf(importedAsset)) + importMediaState = importMediaState.copy(importedAssets = persistentListOf(importedAsset)) } } } @@ -314,7 +317,7 @@ class ImportMediaAuthenticatedViewModel @Inject constructor( handleImportedAsset(fileUri) } ?: listOf() - importMediaState = importMediaState.copy(importedAssets = importedMediaAssets) + importMediaState = importMediaState.copy(importedAssets = importedMediaAssets.toPersistentList()) importedMediaAssets.firstOrNull { it.assetSizeExceeded != null }?.let { onSnackbarMessage(ImportMediaSnackbarMessages.MaxAssetSizeExceeded(it.assetSizeExceeded!!)) @@ -430,8 +433,7 @@ class ImportMediaAuthenticatedViewModel @Inject constructor( assetBundle = assetBundle, width = imgWidth, height = imgHeight, - assetSizeExceeded = assetSizeExceeded, - wireSessionImageLoader = wireSessionImageLoader + assetSizeExceeded = assetSizeExceeded ) } @@ -458,7 +460,7 @@ class ImportMediaAuthenticatedViewModel @Inject constructor( @Stable data class ImportMediaAuthenticatedState( val avatarAsset: ImageAsset.UserAvatarAsset? = null, - val importedAssets: List = emptyList(), + val importedAssets: PersistentList = persistentListOf(), val importedText: String? = null, val isImporting: Boolean = false, val shareableConversationListState: ShareableConversationListState = ShareableConversationListState(), diff --git a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaScreen.kt b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaScreen.kt index 5338e4d37ec..2aabe3bb63a 100644 --- a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaScreen.kt +++ b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportMediaScreen.kt @@ -19,7 +19,6 @@ package com.wire.android.ui.sharing import androidx.activity.compose.BackHandler import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.LocalOverscrollConfiguration import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -30,20 +29,17 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.foundation.pager.HorizontalPager -import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue @@ -88,6 +84,7 @@ import com.wire.android.util.ui.LinkText import com.wire.android.util.ui.LinkTextData import com.wire.kalium.logic.data.id.ConversationId import com.wire.kalium.logic.util.isPositiveNotNull +import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.persistentMapOf import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharedFlow @@ -358,30 +355,16 @@ private fun ImportMediaContent( onConversationClicked: (conversationId: ConversationId) -> Unit, searchBarState: SearchBarState ) { - val importedItemsList: List = state.importedAssets + val importedItemsList: PersistentList = state.importedAssets val itemsToImport = importedItemsList.size - val pagerState = rememberPagerState(pageCount = { itemsToImport }) - val isMultipleImport = itemsToImport > 1 + + val isMultipleImport = itemsToImport != 1 Column( modifier = Modifier .padding(internalPadding) .fillMaxSize() ) { - val horizontalPadding = dimensions().spacing8x - val screenWidth = LocalConfiguration.current.screenWidthDp.dp - val itemWidth = - if (isMultipleImport) dimensions().importedMediaAssetSize + horizontalPadding.times(2) - else screenWidth - (horizontalPadding * 2) - val contentPadding = if (isMultipleImport) { - PaddingValues( - start = horizontalPadding, - end = (screenWidth - itemWidth + horizontalPadding) - ) - } else { - val totalPadding = screenWidth - itemWidth - PaddingValues(start = totalPadding / 2, end = totalPadding / 2) - } val lazyListState = rememberLazyListState() if (state.isImporting) { Box( @@ -396,16 +379,25 @@ private fun ImportMediaContent( size = dimensions().spacing24x ) } + } else if (!isMultipleImport) { + Box(modifier = Modifier.padding(horizontal = dimensions().spacing16x)) { + ImportedMediaItemView( + item = importedItemsList.first(), + isMultipleImport = false + ) + } } else { - CompositionLocalProvider(LocalOverscrollConfiguration provides null) { - HorizontalPager( - state = pagerState, - contentPadding = contentPadding, - pageSpacing = dimensions().spacing8x - ) { page -> + LazyRow( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(dimensions().spacing8x), + contentPadding = PaddingValues(start = dimensions().spacing16x, end = dimensions().spacing16x) + ) { + items( + count = importedItemsList.size, + ) { index -> ImportedMediaItemView( - importedItemsList[page], - isMultipleImport + item = importedItemsList[index], + isMultipleImport = true ) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaAsset.kt b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaAsset.kt index 00454e52f64..1ea9271e704 100644 --- a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaAsset.kt +++ b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaAsset.kt @@ -19,7 +19,6 @@ package com.wire.android.ui.sharing import com.wire.android.model.ImageAsset import com.wire.android.ui.home.conversations.model.AssetBundle -import com.wire.android.util.ui.WireSessionImageLoader sealed class ImportedMediaAsset( open val assetBundle: AssetBundle, @@ -35,8 +34,7 @@ sealed class ImportedMediaAsset( val height: Int, override val assetBundle: AssetBundle, override val assetSizeExceeded: Int?, - val wireSessionImageLoader: WireSessionImageLoader ) : ImportedMediaAsset(assetBundle, assetSizeExceeded) { - val localImageAsset = ImageAsset.LocalImageAsset(wireSessionImageLoader, assetBundle.dataPath, assetBundle.key) + val localImageAsset = ImageAsset.Local(assetBundle.dataPath, assetBundle.key) } } diff --git a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaTypes.kt b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaTypes.kt index b85eca1860f..424b8b62378 100644 --- a/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaTypes.kt +++ b/app/src/main/kotlin/com/wire/android/ui/sharing/ImportedMediaTypes.kt @@ -42,7 +42,6 @@ fun ImportedImageView(item: ImportedMediaAsset.Image, isMultipleImport: Boolean) transferStatus = AssetTransferStatus.NOT_DOWNLOADED, onImageClick = Clickable(enabled = false), shouldFillMaxWidth = !isMultipleImport, - isImportedMediaAsset = true ) } diff --git a/app/src/main/kotlin/com/wire/android/util/ui/AssetImageFetcher.kt b/app/src/main/kotlin/com/wire/android/util/ui/AssetImageFetcher.kt index 505f614073b..66f19ca3fc1 100644 --- a/app/src/main/kotlin/com/wire/android/util/ui/AssetImageFetcher.kt +++ b/app/src/main/kotlin/com/wire/android/util/ui/AssetImageFetcher.kt @@ -73,8 +73,6 @@ internal class AssetImageFetcher( } } } - - is ImageAsset.LocalImageAsset -> drawableResultWrapper.toFetchResult(data.dataPath) } } } @@ -90,9 +88,9 @@ internal class AssetImageFetcher( private val getPrivateAssetUseCase: GetMessageAssetUseCase, private val deleteAssetUseCase: DeleteAssetUseCase, private val drawableResultWrapper: DrawableResultWrapper, - ) : Fetcher.Factory { + ) : Fetcher.Factory { override fun create( - data: ImageAsset, + data: ImageAsset.Remote, options: Options, imageLoader: ImageLoader ): Fetcher = AssetImageFetcher( @@ -106,7 +104,7 @@ internal class AssetImageFetcher( } data class AssetFetcherParameters( - val data: ImageAsset, + val data: ImageAsset.Remote, val options: Options ) diff --git a/app/src/main/kotlin/com/wire/android/util/ui/DrawableResultWrapper.kt b/app/src/main/kotlin/com/wire/android/util/ui/DrawableResultWrapper.kt index 66c494670eb..be2771e20ee 100644 --- a/app/src/main/kotlin/com/wire/android/util/ui/DrawableResultWrapper.kt +++ b/app/src/main/kotlin/com/wire/android/util/ui/DrawableResultWrapper.kt @@ -18,14 +18,13 @@ package com.wire.android.util.ui -import android.content.res.Resources import coil.decode.DataSource import coil.decode.ImageSource import coil.fetch.FetchResult import coil.fetch.SourceResult import okio.Path -internal class DrawableResultWrapper(val resources: Resources) { +internal class DrawableResultWrapper { internal fun toFetchResult(assetPath: Path): FetchResult { return SourceResult( diff --git a/app/src/main/kotlin/com/wire/android/util/ui/WireSessionImageLoader.kt b/app/src/main/kotlin/com/wire/android/util/ui/WireSessionImageLoader.kt index a78af9835f3..ee32413b1ee 100644 --- a/app/src/main/kotlin/com/wire/android/util/ui/WireSessionImageLoader.kt +++ b/app/src/main/kotlin/com/wire/android/util/ui/WireSessionImageLoader.kt @@ -74,7 +74,7 @@ class WireSessionImageLoader( */ @Composable fun paint( - asset: ImageAsset?, + asset: ImageAsset.Remote?, fallbackData: Any? = null, withCrossfadeAnimation: Boolean = false, ): Painter { @@ -124,7 +124,6 @@ class WireSessionImageLoader( private val networkStateObserver: NetworkStateObserver, ) { private val defaultImageLoader = Coil.imageLoader(context) - private val resources = context.resources fun newImageLoader(): WireSessionImageLoader = WireSessionImageLoader( @@ -135,7 +134,7 @@ class WireSessionImageLoader( getPublicAssetUseCase = getAvatarAsset, getPrivateAssetUseCase = getPrivateAsset, deleteAssetUseCase = deleteAsset, - drawableResultWrapper = DrawableResultWrapper(resources), + drawableResultWrapper = DrawableResultWrapper(), ) ) if (SDK_INT >= 28) { diff --git a/app/src/test/kotlin/com/wire/android/model/ImageAssetTest.kt b/app/src/test/kotlin/com/wire/android/model/ImageAssetTest.kt index a7cf6427b9f..61bac0831af 100644 --- a/app/src/test/kotlin/com/wire/android/model/ImageAssetTest.kt +++ b/app/src/test/kotlin/com/wire/android/model/ImageAssetTest.kt @@ -60,8 +60,8 @@ class ImageAssetTest { private fun createLocalAsset( dataPath: Path, imageKey: String - ): ImageAsset.LocalImageAsset { - return ImageAsset.LocalImageAsset(imageLoader, dataPath, imageKey) + ): ImageAsset.Local { + return ImageAsset.Local(dataPath, imageKey) } @Test @@ -150,7 +150,7 @@ class ImageAssetTest { assetKey, ) - subject1.uniqueKey shouldBeEqualTo subject2.uniqueKey + subject1.idKey shouldBeEqualTo subject2.idKey } @Test @@ -167,7 +167,7 @@ class ImageAssetTest { "someOtherAssetKey", ) - baseSubject.uniqueKey shouldNotBeEqualTo alteredAssetKeySubject.uniqueKey + baseSubject.idKey shouldNotBeEqualTo alteredAssetKeySubject.idKey } @Test @@ -185,6 +185,6 @@ class ImageAssetTest { assetKey ) - baseSubject.uniqueKey shouldBeEqualTo alteredUriSubject.uniqueKey + baseSubject.idKey shouldBeEqualTo alteredUriSubject.idKey } } diff --git a/app/src/test/kotlin/com/wire/android/util/ui/AssetImageFetcherTest.kt b/app/src/test/kotlin/com/wire/android/util/ui/AssetImageFetcherTest.kt index b5d1e57edf7..bc9b49db4c4 100644 --- a/app/src/test/kotlin/com/wire/android/util/ui/AssetImageFetcherTest.kt +++ b/app/src/test/kotlin/com/wire/android/util/ui/AssetImageFetcherTest.kt @@ -38,7 +38,6 @@ import io.mockk.coEvery import io.mockk.coVerify import io.mockk.mockk import kotlinx.coroutines.CompletableDeferred -import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest import okio.Path import okio.buffer @@ -46,7 +45,6 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test import org.junit.jupiter.api.assertThrows -@OptIn(ExperimentalCoroutinesApi::class) internal class AssetImageFetcherTest { @Test @@ -287,11 +285,11 @@ internal class AssetImageFetcherTest { val mockFetchResult = mockk() val mockContext = mockk() - lateinit var imageData: ImageAsset + lateinit var imageData: ImageAsset.Remote private var options: Options? = null fun withSuccessfulImageData( - data: ImageAsset, + data: ImageAsset.Remote, expectedAssetPath: Path, expectedAssetSize: Long, assetName: String = "name", @@ -334,7 +332,7 @@ internal class AssetImageFetcherTest { } fun withErrorResponse( - data: ImageAsset, + data: ImageAsset.Remote, isRetryNeeded: Boolean = false, coreFailure: CoreFailure = CoreFailure.Unknown(null) ): Arrangement {