Fixed in-call top bar notification label when going from two calls to one

This commit is contained in:
Sylvain Berfini 2025-07-10 13:38:10 +02:00
parent 8c7c7b40c3
commit c4618702ab

View file

@ -163,7 +163,7 @@ class MainViewModel
state: Call.State?,
message: String
) {
Log.i("$TAG A call's state changed, updating 'alerts' if needed")
Log.i("$TAG Call [${call.remoteAddress.asStringUriOnly()}] state changed to [$state], updating 'alerts' if needed")
if (
core.callsNb > 1 && (
LinphoneUtils.isCallEnding(call.state) ||
@ -173,9 +173,16 @@ class MainViewModel
) {
updateCallAlert()
} else if (core.callsNb == 1) {
if (callsStatus.value.orEmpty().isEmpty()) {
// In case there was more than one call and now there is only one left
updateCallAlert()
} else if (call.state != Call.State.Released) {
// When you have two calls, when the one is ended core.callsNb will become 1
// but the ended one will still go to Released state after that
callsStatus.postValue(LinphoneUtils.callStateToString(call.state))
}
}
}
@WorkerThread
override fun onMessagesReceived(
@ -564,7 +571,7 @@ class MainViewModel
}
} else if (callsNb > 1) {
callLabel.postValue(AppUtils.getFormattedString(R.string.calls_count_label, callsNb))
callsStatus.postValue("") // TODO: improve ?
callsStatus.postValue("")
}
}