Renames Hex Check method for better understanding.

This commit is contained in:
Vitor Pamplona
2023-07-03 08:36:33 -04:00
parent 91c47b6e87
commit 3a1694ac9a
@@ -35,7 +35,7 @@ object LocalCache {
fun checkGetOrCreateUser(key: String): User? { fun checkGetOrCreateUser(key: String): User? {
checkNotInMainThread() checkNotInMainThread()
if (isValidHexNpub(key)) { if (isValidHex(key)) {
return getOrCreateUser(key) return getOrCreateUser(key)
} }
return null return null
@@ -69,7 +69,7 @@ object LocalCache {
if (ATag.isATag(key)) { if (ATag.isATag(key)) {
return checkGetOrCreateAddressableNote(key) return checkGetOrCreateAddressableNote(key)
} }
if (isValidHexNpub(key)) { if (isValidHex(key)) {
val note = getOrCreateNote(key) val note = getOrCreateNote(key)
val noteEvent = note.event val noteEvent = note.event
if (noteEvent is AddressableEvent) { if (noteEvent is AddressableEvent) {
@@ -94,7 +94,7 @@ object LocalCache {
fun checkGetOrCreateChannel(key: String): Channel? { fun checkGetOrCreateChannel(key: String): Channel? {
checkNotInMainThread() checkNotInMainThread()
if (isValidHexNpub(key)) { if (isValidHex(key)) {
return getOrCreateChannel(key) { return getOrCreateChannel(key) {
PublicChatChannel(key) PublicChatChannel(key)
} }
@@ -108,7 +108,7 @@ object LocalCache {
return null return null
} }
private fun isValidHexNpub(key: String): Boolean { private fun isValidHex(key: String): Boolean {
if (key.isBlank()) return false if (key.isBlank()) return false
if (key.contains(":")) return false if (key.contains(":")) return false
@@ -798,7 +798,7 @@ object LocalCache {
note.loadEvent(event, author, replyTo) note.loadEvent(event, author, replyTo)
// Log.d("CM", "New Note (${notes.size},${users.size}) ${note.author?.toBestDisplayName()} ${note.event?.content()} ${formattedDateTime(event.createdAt)}") Log.d("CM", "New Chat Note (${note.author?.toBestDisplayName()} ${note.event?.content()} ${formattedDateTime(event.createdAt)}")
// Counts the replies // Counts the replies
replyTo.forEach { replyTo.forEach {