Hide empty URL previews
Change-Id: I10a2f78e7efa96249adb7cd4849e54150a08001a
This commit is contained in:
parent
9e99fcb7ff
commit
12eb1ea68d
|
@ -48,4 +48,11 @@ data class PreviewUrlData(
|
|||
val description: String?,
|
||||
// Value of field "og:image"
|
||||
val mxcUrl: String?
|
||||
)
|
||||
) {
|
||||
fun isPreviewable(): Boolean {
|
||||
return siteName?.isNotEmpty() == true ||
|
||||
title?.isNotEmpty() == true ||
|
||||
description?.isNotEmpty() == true ||
|
||||
mxcUrl?.isNotEmpty() == true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@ class PreviewUrlRetriever(session: Session) {
|
|||
// Blocked after the request has been sent?
|
||||
if (urlToRetrieve in blockedUrl) {
|
||||
updateState(eventId, PreviewUrlUiState.NoUrl)
|
||||
} else if (!it.isPreviewable()) { // Nothing to show
|
||||
updateState(eventId, PreviewUrlUiState.NoUrl)
|
||||
} else {
|
||||
updateState(eventId, PreviewUrlUiState.Data(eventId, urlToRetrieve, it))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue