actually use the image from the 10011 event

This commit is contained in:
Believethehype 2024-06-29 15:08:58 +02:00
parent 5cbea6999e
commit 16eb6097ce
4 changed files with 21 additions and 6 deletions

View File

@ -139,6 +139,8 @@ open class Note(
var relays = listOf<RelayBriefInfoCache.RelayBriefInfo>()
private set
var headerImage: String? = null
var lastReactionsDownloadTime: Map<String, EOSETime> = emptyMap()
fun id() = Hex.decode(idHex)

View File

@ -34,7 +34,7 @@ class UserProfileGalleryFeedFilter(val user: User, val account: Account) : FeedF
val notes =
user.latestGalleryList
?.taggedGalleryEntries()
?.mapNotNull { LocalCache.checkGetOrCreateNote(it.id) }
?.map { Pair(LocalCache.getOrCreateNote(it.id), it.url) }
?.toSet()
?: emptySet()
@ -46,7 +46,15 @@ class UserProfileGalleryFeedFilter(val user: User, val account: Account) : FeedF
?: emptySet() */
// .sortedWith(DefaultFeedOrder)
return (notes)
var finalnotes = setOf<Note>()
for (pair in notes) {
pair.first.headerImage = pair.second
finalnotes = finalnotes + pair.first
}
println(finalnotes)
return (finalnotes)
.filter { account.isAcceptable(it) }
}
}

View File

@ -669,7 +669,11 @@ fun DeleteFromGalleryDialog(
buttonIcon = Icons.Default.Delete,
buttonText = stringRes(R.string.quick_action_delete_dialog_btn),
onClickDoOnce = {
note.event?.firstTaggedUrl()?.let { accountViewModel.removefromMediaGallery(note, it) }
note.headerImage.let {
if (it != null) {
accountViewModel.removefromMediaGallery(note, it)
}
}
onDismiss()
},
onDismiss = onDismiss,

View File

@ -282,10 +282,9 @@ fun RenderGalleryThumb(
.metadata
.map {
val noteEvent = baseNote.event as TextNoteEvent
GalleryThumb(
id = "",
image = noteEvent.firstTaggedUrl(),
image = baseNote.headerImage,
title = noteEvent.content(),
// noteEvent?.title(),
// price = noteEvent?.price(),
@ -294,7 +293,7 @@ fun RenderGalleryThumb(
.observeAsState(
GalleryThumb(
id = "",
image = noteEvent.firstTaggedUrl(),
image = baseNote.headerImage,
title = noteEvent.content(),
// image = noteEvent.image(),
// title = noteEvent.title(),
@ -342,6 +341,8 @@ fun InnerRenderGalleryThumb(
)
} ?: run { DisplayGalleryAuthorBanner(note) }
// TODO what if video?
/* Row(
Modifier
.fillMaxWidth()