kopia lustrzana https://github.com/vitorpamplona/amethyst
Fixing relative paths on OG:IMAGE tags to correctly see a preview card
rodzic
9432135847
commit
58e0aa5f8f
|
@ -103,7 +103,7 @@ dependencies {
|
|||
implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha05'
|
||||
|
||||
// view videos
|
||||
implementation 'com.google.android.exoplayer:exoplayer:2.18.3'
|
||||
implementation 'com.google.android.exoplayer:exoplayer:2.18.4'
|
||||
|
||||
// Load images from the web.
|
||||
implementation "io.coil-kt:coil-compose:2.2.2"
|
||||
|
|
|
@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp
|
|||
import coil.compose.AsyncImage
|
||||
import com.baha.url.preview.UrlInfoItem
|
||||
import com.vitorpamplona.amethyst.R
|
||||
import java.net.URL
|
||||
|
||||
@Composable
|
||||
fun UrlPreviewCard(
|
||||
|
@ -36,8 +37,14 @@ fun UrlPreviewCard(
|
|||
.border(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.12f), RoundedCornerShape(15.dp))
|
||||
) {
|
||||
Column {
|
||||
// correctly treating relative images
|
||||
val imageUrl = if (previewInfo.image.startsWith("/"))
|
||||
URL(URL(previewInfo.url), previewInfo.image).toString()
|
||||
else
|
||||
previewInfo.image
|
||||
|
||||
AsyncImage(
|
||||
model = previewInfo.image,
|
||||
model = imageUrl,
|
||||
contentDescription = stringResource(R.string.preview_card_image_for, url),
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
|
|
Ładowanie…
Reference in New Issue