Removes warnings from the quartz library.

This commit is contained in:
Vitor Pamplona
2024-03-01 10:40:12 -05:00
parent 238e577b93
commit 7468352795
5 changed files with 24 additions and 18 deletions
@@ -30,7 +30,7 @@ class Lud06 {
fun toLud16(str: String): String? { fun toLud16(str: String): String? {
return try { return try {
val url = toLnUrlp(str) val url = toLnUrlp(str) ?: return null
val matcher = LNURLP_PATTERN.matcher(url) val matcher = LNURLP_PATTERN.matcher(url)
if (matcher.find()) { if (matcher.find()) {
@@ -94,7 +94,9 @@ object Nip19Bech32 {
val key = matcher.group(3) // bech32 val key = matcher.group(3) // bech32
val additionalChars = matcher.group(4) // additional chars val additionalChars = matcher.group(4) // additional chars
return parseComponents(type!!, key, additionalChars) if (type == null) return null
return parseComponents(type, key, additionalChars)
} catch (e: Throwable) { } catch (e: Throwable) {
Log.e("NIP19 Parser", "Issue trying to Decode NIP19 $uri: ${e.message}", e) Log.e("NIP19 Parser", "Issue trying to Decode NIP19 $uri: ${e.message}", e)
} }
@@ -105,14 +105,16 @@ open class BaseTextNoteEvent(
val additionalChars = matcher2.group(4) // additional chars val additionalChars = matcher2.group(4) // additional chars
try { try {
val parsed = Nip19Bech32.parseComponents(type, key, additionalChars)?.entity if (type != null) {
val parsed = Nip19Bech32.parseComponents(type, key, additionalChars)?.entity
if (parsed != null) { if (parsed != null) {
if (parsed is Nip19Bech32.NProfile) { if (parsed is Nip19Bech32.NProfile) {
returningList.add(parsed.hex) returningList.add(parsed.hex)
} }
if (parsed is Nip19Bech32.NPub) { if (parsed is Nip19Bech32.NPub) {
returningList.add(parsed.hex) returningList.add(parsed.hex)
}
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
@@ -151,14 +153,16 @@ open class BaseTextNoteEvent(
val key = matcher2.group(3) // bech32 val key = matcher2.group(3) // bech32
val additionalChars = matcher2.group(4) // additional chars val additionalChars = matcher2.group(4) // additional chars
val parsed = Nip19Bech32.parseComponents(type, key, additionalChars)?.entity if (type != null) {
val parsed = Nip19Bech32.parseComponents(type, key, additionalChars)?.entity
if (parsed != null) { if (parsed != null) {
when (parsed) { when (parsed) {
is Nip19Bech32.NEvent -> citations.add(parsed.hex) is Nip19Bech32.NEvent -> citations.add(parsed.hex)
is Nip19Bech32.NAddress -> citations.add(parsed.atag) is Nip19Bech32.NAddress -> citations.add(parsed.atag)
is Nip19Bech32.Note -> citations.add(parsed.hex) is Nip19Bech32.Note -> citations.add(parsed.hex)
is Nip19Bech32.NEmbed -> citations.add(parsed.event.id) is Nip19Bech32.NEmbed -> citations.add(parsed.event.id)
}
} }
} }
} }
@@ -63,7 +63,7 @@ interface EventInterface {
fun isTaggedUser(idHex: String): Boolean fun isTaggedUser(idHex: String): Boolean
fun isTaggedUsers(idHex: Set<String>): Boolean fun isTaggedUsers(idHexes: Set<String>): Boolean
fun isTaggedEvent(idHex: String): Boolean fun isTaggedEvent(idHex: String): Boolean
@@ -60,7 +60,7 @@ class GitPatchEvent(
fun commitPGPSig() = tags.firstOrNull { it.size > 1 && it[0] == "commit-pgp-sig" }?.get(1) fun commitPGPSig() = tags.firstOrNull { it.size > 1 && it[0] == "commit-pgp-sig" }?.get(1)
fun committer() = fun committer() =
tags.filter { it.size > 1 && it[0] == "committer" }?.mapNotNull { tags.filter { it.size > 1 && it[0] == "committer" }.mapNotNull {
Committer(it.getOrNull(1), it.getOrNull(2), it.getOrNull(3), it.getOrNull(4)) Committer(it.getOrNull(1), it.getOrNull(2), it.getOrNull(3), it.getOrNull(4))
} }