- Tried to align alerts with material design guidelines.
- Still more work on strings.
This commit is contained in:
@@ -145,8 +145,18 @@ object Utils {
|
||||
}
|
||||
}
|
||||
|
||||
fun aorUser(aor: String): String {
|
||||
val user = aor.substringBefore("@")
|
||||
return if (user == aor) "" else user
|
||||
}
|
||||
|
||||
fun aorDomain(aor: String): String {
|
||||
return aor.substringAfter("@")
|
||||
val domain = aor.substringAfter("@")
|
||||
return if (domain == aor) "" else domain
|
||||
}
|
||||
|
||||
fun checkAor(aor: String): Boolean {
|
||||
return checkUriUser(aorUser(aor)) && checkDomain(aorDomain(aor))
|
||||
}
|
||||
|
||||
fun checkTelNo(no: String): Boolean {
|
||||
@@ -244,14 +254,6 @@ object Utils {
|
||||
return false
|
||||
}
|
||||
|
||||
fun checkAorUri(uri: String): Boolean {
|
||||
if (!uri.startsWith("sip:")) return false
|
||||
val userDomain = uri.replace("sip:", "").split("@")
|
||||
if (userDomain.size != 2) return false
|
||||
if (!checkUriUser(userDomain[0])) return false
|
||||
return checkDomain(userDomain[1]) || checkIp(userDomain[1])
|
||||
}
|
||||
|
||||
fun checkPrintAscii(s: String): Boolean {
|
||||
if (s == "") return true
|
||||
return Regex("^[ -~]*\$").matches(s)
|
||||
|
||||
Reference in New Issue
Block a user