mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-01 15:33:28 +00:00
Optimise SnodeAPI further
This commit is contained in:
@@ -52,6 +52,8 @@ class Snode(val address: String, val port: Int, val publicKeySet: KeySet?, val v
|
||||
fun Version(value: String) = CACHE.getOrElse(value) {
|
||||
Snode.Version(value)
|
||||
}
|
||||
|
||||
fun Version(parts: List<Int>) = Version(parts.joinToString("."))
|
||||
}
|
||||
|
||||
@JvmInline
|
||||
@@ -66,14 +68,12 @@ class Snode(val address: String, val port: Int, val publicKeySet: KeySet?, val v
|
||||
}
|
||||
}
|
||||
|
||||
constructor(parts: List<Int>): this(
|
||||
internal constructor(parts: List<Int>): this(
|
||||
parts.asSequence()
|
||||
.map { it.toByte().toULong() }
|
||||
.foldToVersionAsULong()
|
||||
)
|
||||
|
||||
constructor(value: Int): this(value.toULong())
|
||||
|
||||
internal constructor(value: String): this(
|
||||
value.splitToSequence(".")
|
||||
.map { it.toULongOrNull() ?: 0UL }
|
||||
|
||||
Reference in New Issue
Block a user