mirror of
https://github.com/Ashinch/ReadYou.git
synced 2025-01-31 11:35:10 +01:00
fix(image): load referer image only when needed
This commit is contained in:
parent
26b8bc2e14
commit
f421ae063a
@ -35,16 +35,19 @@ fun RYAsyncImage(
|
|||||||
) {
|
) {
|
||||||
Image(
|
Image(
|
||||||
painter = rememberAsyncImagePainter(
|
painter = rememberAsyncImagePainter(
|
||||||
ImageRequest.Builder(LocalContext.current).addHeader(
|
model = ImageRequest.Builder(LocalContext.current).apply {
|
||||||
"Referer", (data as String).extractDomain() ?: ""
|
val domain = data.toString().extractDomain()
|
||||||
).data(data = data).apply {
|
if (data.toString().extractDomain() != null) {
|
||||||
|
addHeader("Referer", domain!!)
|
||||||
|
}
|
||||||
|
}.data(data = data).apply {
|
||||||
if (placeholder != null) placeholder(placeholder)
|
if (placeholder != null) placeholder(placeholder)
|
||||||
if (error != null) error(error)
|
if (error != null) error(error)
|
||||||
crossfade(true)
|
crossfade(true)
|
||||||
scale(scale)
|
scale(scale)
|
||||||
precision(precision)
|
precision(precision)
|
||||||
size(size)
|
size(size)
|
||||||
}.build()
|
}.build(),
|
||||||
),
|
),
|
||||||
contentDescription = contentDescription,
|
contentDescription = contentDescription,
|
||||||
contentScale = contentScale,
|
contentScale = contentScale,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user