DVM: adapt nip89 naming, show picture then image (legacy)

This commit is contained in:
Believethehype
2024-12-02 19:55:02 +01:00
parent bd2005ec6e
commit e0e898d4b1
2 changed files with 7 additions and 7 deletions

View File

@@ -646,14 +646,14 @@ fun observeAppDefinition(appDefinitionNote: Note): DVMCard {
DVMCard( DVMCard(
name = noteEvent?.appMetaData()?.name ?: "", name = noteEvent?.appMetaData()?.name ?: "",
description = noteEvent?.appMetaData()?.about ?: "", description = noteEvent?.appMetaData()?.about ?: "",
cover = noteEvent?.appMetaData()?.image?.ifBlank { null }, cover = noteEvent?.appMetaData()?.profilePicture()?.ifBlank { null },
) )
}.distinctUntilChanged() }.distinctUntilChanged()
.observeAsState( .observeAsState(
DVMCard( DVMCard(
name = noteEvent.appMetaData()?.name ?: "", name = noteEvent.appMetaData()?.name ?: "",
description = noteEvent.appMetaData()?.about ?: "", description = noteEvent.appMetaData()?.about ?: "",
cover = noteEvent.appMetaData()?.image?.ifBlank { null }, cover = noteEvent.appMetaData()?.profilePicture()?.ifBlank { null },
), ),
) )

View File

@@ -45,8 +45,8 @@ class AppMetadata {
var website: String? = null var website: String? = null
var about: String? = null var about: String? = null
var subscription: Boolean? = false var subscription: Boolean? = false
var cashuAccepted: Boolean? = false var acceptsNutZaps: Boolean? = false
var encryptionSupported: Boolean? = false var supportsEncryption: Boolean? = false
var personalized: Boolean? = false var personalized: Boolean? = false
var amount: String? = null var amount: String? = null
@@ -71,8 +71,8 @@ class AppMetadata {
(website?.bytesUsedInMemory() ?: 0L) + (website?.bytesUsedInMemory() ?: 0L) +
(about?.bytesUsedInMemory() ?: 0L) + (about?.bytesUsedInMemory() ?: 0L) +
(subscription?.bytesUsedInMemory() ?: 0L) + (subscription?.bytesUsedInMemory() ?: 0L) +
(cashuAccepted?.bytesUsedInMemory() ?: 0L) + (acceptsNutZaps?.bytesUsedInMemory() ?: 0L) +
(encryptionSupported?.bytesUsedInMemory() ?: 0L) + (supportsEncryption?.bytesUsedInMemory() ?: 0L) +
(personalized?.bytesUsedInMemory() ?: 0L) + // A Boolean has 8 bytes of header, plus 1 byte of payload, for a total of 9 bytes of information. The JVM then rounds it up to the next multiple of 8. so the one instance of java.lang.Boolean takes up 16 bytes of memory. (personalized?.bytesUsedInMemory() ?: 0L) + // A Boolean has 8 bytes of header, plus 1 byte of payload, for a total of 9 bytes of information. The JVM then rounds it up to the next multiple of 8. so the one instance of java.lang.Boolean takes up 16 bytes of memory.
(amount?.bytesUsedInMemory() ?: 0L) + (amount?.bytesUsedInMemory() ?: 0L) +
(nip05?.bytesUsedInMemory() ?: 0L) + (nip05?.bytesUsedInMemory() ?: 0L) +
@@ -95,7 +95,7 @@ class AppMetadata {
fun nip05(): String? = nip05 fun nip05(): String? = nip05
fun profilePicture(): String? = picture fun profilePicture(): String? = picture ?: image
fun cleanBlankNames() { fun cleanBlankNames() {
if (picture?.isNotEmpty() == true) picture = picture?.trim() if (picture?.isNotEmpty() == true) picture = picture?.trim()