Refactoring

This commit is contained in:
Vitor Pamplona
2024-06-11 18:19:07 -04:00
parent b785e0d505
commit cafad6a003
5 changed files with 10 additions and 10 deletions
@@ -193,8 +193,7 @@ open class BaseTextNoteEvent(
val repliesTo = replyTos()
val tagAddresses =
taggedAddresses().filter {
it.kind != CommunityDefinitionEvent.KIND &&
(kind != WikiNoteEvent.KIND || it.kind != WikiNoteEvent.KIND)
it.kind != CommunityDefinitionEvent.KIND && (kind != WikiNoteEvent.KIND || it.kind != WikiNoteEvent.KIND)
// removes forks from itself.
}.map { it.toTag() }
if (repliesTo.isEmpty() && tagAddresses.isEmpty()) return emptyList()
@@ -43,6 +43,7 @@ import com.vitorpamplona.quartz.encoders.Nip19Bech32
import com.vitorpamplona.quartz.encoders.toHexKey
import com.vitorpamplona.quartz.signers.NostrSigner
import com.vitorpamplona.quartz.utils.TimeUtils
import com.vitorpamplona.quartz.utils.bytesUsedInMemory
import java.math.BigDecimal
import java.security.MessageDigest
@@ -564,10 +565,6 @@ open class BaseAddressableEvent(
override fun addressTag() = ATag.assembleATag(kind, pubKey, dTag())
}
fun String.bytesUsedInMemory(): Int {
return (8 * ((((this.length) * 2) + 45) / 8))
}
data class ZapSplitSetup(
val lnAddressOrPubKeyHex: String,
val relay: String?,
@@ -22,6 +22,10 @@ package com.vitorpamplona.quartz.utils
import kotlin.math.min
fun String.bytesUsedInMemory(): Int {
return (8 * ((((this.length) * 2) + 45) / 8))
}
fun String.containsIgnoreCase(term: String): Boolean {
if (term.isEmpty()) return true // Empty string is contained