mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Address review
This commit is contained in:
+9
-10
@@ -36,17 +36,16 @@ internal class CoilMediaFetcher(
|
||||
return when (val kind = mediaData.kind) {
|
||||
is MediaRequestData.Kind.Content -> fetchContent(mediaSource)
|
||||
is MediaRequestData.Kind.Thumbnail -> {
|
||||
val thumbnailResult = fetchThumbnail(mediaSource, kind)
|
||||
if (thumbnailResult.isSuccess) {
|
||||
thumbnailResult.getOrThrow()
|
||||
} else {
|
||||
val error = thumbnailResult.exceptionOrNull()
|
||||
if (error?.isNetworkError() == true) {
|
||||
null
|
||||
} else {
|
||||
fetchContent(mediaSource)
|
||||
fetchThumbnail(mediaSource, kind).fold(
|
||||
onSuccess = { it },
|
||||
onFailure = { error ->
|
||||
if (error.isNetworkError()) {
|
||||
null
|
||||
} else {
|
||||
fetchContent(mediaSource)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
is MediaRequestData.Kind.File -> fetchFile(mediaSource, kind)
|
||||
}
|
||||
|
||||
-1
@@ -42,7 +42,6 @@ class DefaultImageLoaderFactory(
|
||||
return ImageLoader.Builder(context)
|
||||
.components {
|
||||
add(okHttpNetworkFetcherFactory)
|
||||
add(SvgDecoder.Factory())
|
||||
}
|
||||
.build()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user