Merge branch 'main' into amber

This commit is contained in:
greenart7c3
2023-09-11 07:20:03 -03:00
committed by GitHub
13 changed files with 386 additions and 129 deletions
@@ -12,18 +12,19 @@ fun HexKey.hexToByteArray(): ByteArray {
}
object HexValidator {
private fun isHex2(c: Char): Boolean {
private fun isHexChar(c: Char): Boolean {
return when (c) {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F', ' ' -> true
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F' -> true
else -> false
}
}
fun isHex(hex: String?): Boolean {
if (hex == null) return false
if (hex.length % 2 != 0) return false // must be even
var isHex = true
for (c in hex.toCharArray()) {
if (!isHex2(c)) {
if (!isHexChar(c)) {
isHex = false
break
}
@@ -21,7 +21,7 @@ class LnZapEvent(
fromJson(it)
} as? LnZapRequestEvent
} catch (e: Exception) {
Log.w("LnZapEvent", "Failed to Parse Contained Post ${description()}", e)
Log.w("LnZapEvent", "Failed to Parse Contained Post ${description()} in event ${id}", e)
null
}