mirror of
https://github.com/yggdrasil-network/crispa-android.git
synced 2025-01-22 16:06:30 +00:00
1. added new peer input fields checks
This commit is contained in:
parent
72ec1a5300
commit
a7322a7ff3
@ -161,8 +161,20 @@ class PeerListActivity : AppCompatActivity() {
|
|||||||
var portInput = view.findViewById<TextView>(R.id.portInput)
|
var portInput = view.findViewById<TextView>(R.id.portInput)
|
||||||
var ccpInput = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp)
|
var ccpInput = view.findViewById<com.hbb20.CountryCodePicker>(R.id.ccp)
|
||||||
var schema = schemaInput.text.toString().toLowerCase()
|
var schema = schemaInput.text.toString().toLowerCase()
|
||||||
|
if(schema.isEmpty()){
|
||||||
|
schemaInput.error = "Schema is required"
|
||||||
|
}
|
||||||
var ip = ipInput.text.toString().toLowerCase()
|
var ip = ipInput.text.toString().toLowerCase()
|
||||||
|
if(ip.isEmpty()){
|
||||||
|
ipInput.error = "IP address is required"
|
||||||
|
}
|
||||||
var port = portInput.text.toString().toInt()
|
var port = portInput.text.toString().toInt()
|
||||||
|
if(port<=0){
|
||||||
|
portInput.error = "Port should be > 0"
|
||||||
|
}
|
||||||
|
if(port>=Short.MAX_VALUE){
|
||||||
|
portInput.error = "Port should be < "+Short.MAX_VALUE
|
||||||
|
}
|
||||||
var ccp = ccpInput.selectedCountryNameCode
|
var ccp = ccpInput.selectedCountryNameCode
|
||||||
GlobalScope.launch {
|
GlobalScope.launch {
|
||||||
var pi = PeerInfo(schema, InetAddress.getByName(ip), port, ccp)
|
var pi = PeerInfo(schema, InetAddress.getByName(ip), port, ccp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user