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(
|
||||
painter = rememberAsyncImagePainter(
|
||||
ImageRequest.Builder(LocalContext.current).addHeader(
|
||||
"Referer", (data as String).extractDomain() ?: ""
|
||||
).data(data = data).apply {
|
||||
model = ImageRequest.Builder(LocalContext.current).apply {
|
||||
val domain = data.toString().extractDomain()
|
||||
if (data.toString().extractDomain() != null) {
|
||||
addHeader("Referer", domain!!)
|
||||
}
|
||||
}.data(data = data).apply {
|
||||
if (placeholder != null) placeholder(placeholder)
|
||||
if (error != null) error(error)
|
||||
crossfade(true)
|
||||
scale(scale)
|
||||
precision(precision)
|
||||
size(size)
|
||||
}.build()
|
||||
}.build(),
|
||||
),
|
||||
contentDescription = contentDescription,
|
||||
contentScale = contentScale,
|
||||
|
Loading…
x
Reference in New Issue
Block a user