diff --git a/app/src/main/java/org/linphone/activities/call/viewmodels/CallsViewModel.kt b/app/src/main/java/org/linphone/activities/call/viewmodels/CallsViewModel.kt index ed235e5a4..217829ef9 100644 --- a/app/src/main/java/org/linphone/activities/call/viewmodels/CallsViewModel.kt +++ b/app/src/main/java/org/linphone/activities/call/viewmodels/CallsViewModel.kt @@ -54,8 +54,7 @@ class CallsViewModel : ViewModel() { val currentCall = core.currentCall if (currentCall == null) { currentCallViewModel.value?.destroy() - currentCallViewModel.value = null - } else if (currentCallViewModel.value == null) { + } else if (currentCallViewModel.value?.call != currentCall) { currentCallViewModel.value = CallViewModel(currentCall) } diff --git a/app/src/main/java/org/linphone/activities/main/dialer/viewmodels/DialerViewModel.kt b/app/src/main/java/org/linphone/activities/main/dialer/viewmodels/DialerViewModel.kt index 0ac7c56b6..05c80cf06 100644 --- a/app/src/main/java/org/linphone/activities/main/dialer/viewmodels/DialerViewModel.kt +++ b/app/src/main/java/org/linphone/activities/main/dialer/viewmodels/DialerViewModel.kt @@ -101,14 +101,15 @@ class DialerViewModel : LogsUploadViewModel() { } override fun onNetworkReachable(core: Core, reachable: Boolean) { - if (reachable && addressWaitingNetworkToBeCalled.orEmpty().isNotEmpty()) { + val address = addressWaitingNetworkToBeCalled.orEmpty() + if (reachable && address.isNotEmpty()) { val now = System.currentTimeMillis() if (now - timeAtWitchWeTriedToCall > 1000) { - Log.e("[Dialer] More than 1 second has passed waiting for network, abort auto call to $addressWaitingNetworkToBeCalled") - enteredUri.value = addressWaitingNetworkToBeCalled + Log.e("[Dialer] More than 1 second has passed waiting for network, abort auto call to $address") + enteredUri.value = address } else { - Log.i("[Dialer] Network is available, continue auto call to $addressWaitingNetworkToBeCalled") - coreContext.startCall(addressWaitingNetworkToBeCalled.orEmpty()) + Log.i("[Dialer] Network is available, continue auto call to $address") + coreContext.startCall(address) } addressWaitingNetworkToBeCalled = null