- Tried to align alerts with material design guidelines.

- Still more work on strings.
This commit is contained in:
Juha Heinanen
2019-05-11 15:27:35 +03:00
parent c061c5d2f9
commit e4fbb71d16
20 changed files with 284 additions and 216 deletions
@@ -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)