Code styling
This commit is contained in:
@ -874,7 +874,8 @@ class BaresipService: Service() {
|
|||||||
if (VERSION.SDK_INT < 29) {
|
if (VERSION.SDK_INT < 29) {
|
||||||
Log.d(TAG, "Removing Mobile account on API < 29")
|
Log.d(TAG, "Removing Mobile account on API < 29")
|
||||||
removeMobile = true
|
removeMobile = true
|
||||||
} else if (Utils.pstnAccountHandle(this) == null || !isSimReady()) {
|
}
|
||||||
|
else if (Utils.pstnAccountHandle(this) == null || !isSimReady()) {
|
||||||
Log.d(TAG, "Removing Mobile account (SIM not ready or not default dialer)")
|
Log.d(TAG, "Removing Mobile account (SIM not ready or not default dialer)")
|
||||||
removeMobile = true
|
removeMobile = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,15 +19,12 @@ class UserAgent(val uap: Long, virtualAccount: Account? = null) {
|
|||||||
synchronized(uas) {
|
synchronized(uas) {
|
||||||
val updatedUas = uas.value.toMutableList()
|
val updatedUas = uas.value.toMutableList()
|
||||||
val index = updatedUas.indexOfFirst { Utils.uriMatch(it.account.aor, this.account.aor) }
|
val index = updatedUas.indexOfFirst { Utils.uriMatch(it.account.aor, this.account.aor) }
|
||||||
if (index == -1) {
|
if (index == -1)
|
||||||
updatedUas.add(this)
|
updatedUas.add(this)
|
||||||
} else {
|
else if (updatedUas[index].uap == 0L && this.uap != 0L)
|
||||||
if (updatedUas[index].uap == 0L && this.uap != 0L) {
|
updatedUas[index] = this
|
||||||
updatedUas[index] = this
|
else
|
||||||
} else {
|
return
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uas.value = updatedUas.toList()
|
uas.value = updatedUas.toList()
|
||||||
uasStatus.value = statusMap()
|
uasStatus.value = statusMap()
|
||||||
}
|
}
|
||||||
@ -61,8 +58,7 @@ class UserAgent(val uap: Long, virtualAccount: Account? = null) {
|
|||||||
fun currentCall(): Call? {
|
fun currentCall(): Call? {
|
||||||
synchronized(BaresipService.calls) {
|
synchronized(BaresipService.calls) {
|
||||||
for (c in BaresipService.calls.reversed())
|
for (c in BaresipService.calls.reversed())
|
||||||
if (c.ua == this)
|
if (c.ua == this) return c
|
||||||
return c
|
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -114,19 +110,16 @@ class UserAgent(val uap: Long, virtualAccount: Account? = null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun findAorIndex(aor: String): Int? {
|
fun findAorIndex(aor: String): Int? {
|
||||||
for (i in uas.value.indices) {
|
for (i in uas.value.indices)
|
||||||
if (uas.value[i].account.aor == aor) return i
|
if (uas.value[i].account.aor == aor) return i
|
||||||
}
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun register() {
|
fun register() {
|
||||||
for (ua in uas.value) {
|
for (ua in uas.value)
|
||||||
if (ua.account.regint > 0) {
|
if (ua.account.regint > 0)
|
||||||
if (Api.ua_register(ua.uap) != 0)
|
if (Api.ua_register(ua.uap) != 0)
|
||||||
Log.d(TAG, "Failed to register ${ua.account.aor}")
|
Log.d(TAG, "Failed to register ${ua.account.aor}")
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateColorblindStatus() {
|
fun updateColorblindStatus() {
|
||||||
|
|||||||
Reference in New Issue
Block a user