mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-23 06:31:33 +00:00
Clean
This commit is contained in:
parent
460f25629b
commit
438b33d355
@ -69,10 +69,10 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
swarmAsString.split(", ").mapNotNull { targetAsString ->
|
swarmAsString.split(", ").mapNotNull { targetAsString ->
|
||||||
val components = targetAsString.split("-")
|
val components = targetAsString.split("-")
|
||||||
val address = components[0]
|
val address = components[0]
|
||||||
val port = components.getOrNull(1) ?: return@mapNotNull null
|
val port = components.getOrNull(1)?.toIntOrNull() ?: return@mapNotNull null
|
||||||
val identificationKey = components.getOrNull(2) ?: return@mapNotNull null
|
val idKey = components.getOrNull(2) ?: return@mapNotNull null
|
||||||
val encryptionKey = components.getOrNull(3)?: return@mapNotNull null
|
val encryptionKey = components.getOrNull(3)?: return@mapNotNull null
|
||||||
LokiAPITarget(address, port.toInt(), LokiAPITarget.Keys(identificationKey, encryptionKey))
|
LokiAPITarget(address, port, LokiAPITarget.KeySet(idKey, encryptionKey))
|
||||||
}
|
}
|
||||||
}?.toSet()
|
}?.toSet()
|
||||||
}
|
}
|
||||||
@ -81,9 +81,9 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
val database = databaseHelper.writableDatabase
|
val database = databaseHelper.writableDatabase
|
||||||
val swarmAsString = newValue.joinToString(", ") { target ->
|
val swarmAsString = newValue.joinToString(", ") { target ->
|
||||||
var string = "${target.address}-${target.port}"
|
var string = "${target.address}-${target.port}"
|
||||||
val keys = target.publicKeys
|
val keySet = target.publicKeySet
|
||||||
if (keys != null) {
|
if (keySet != null) {
|
||||||
string += "-${keys.identification}-${keys.encryption}"
|
string += "-${keySet.idKey}-${keySet.encryptionKey}"
|
||||||
}
|
}
|
||||||
string
|
string
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user