Fixed build

This commit is contained in:
Sylvain Berfini 2021-06-04 11:10:49 +02:00
parent 37ed867bf1
commit 2c4df28603
2 changed files with 7 additions and 7 deletions

View file

@ -54,8 +54,7 @@ class CallsViewModel : ViewModel() {
val currentCall = core.currentCall val currentCall = core.currentCall
if (currentCall == null) { if (currentCall == null) {
currentCallViewModel.value?.destroy() currentCallViewModel.value?.destroy()
currentCallViewModel.value = null } else if (currentCallViewModel.value?.call != currentCall) {
} else if (currentCallViewModel.value == null) {
currentCallViewModel.value = CallViewModel(currentCall) currentCallViewModel.value = CallViewModel(currentCall)
} }

View file

@ -101,14 +101,15 @@ class DialerViewModel : LogsUploadViewModel() {
} }
override fun onNetworkReachable(core: Core, reachable: Boolean) { override fun onNetworkReachable(core: Core, reachable: Boolean) {
if (reachable && addressWaitingNetworkToBeCalled.orEmpty().isNotEmpty()) { val address = addressWaitingNetworkToBeCalled.orEmpty()
if (reachable && address.isNotEmpty()) {
val now = System.currentTimeMillis() val now = System.currentTimeMillis()
if (now - timeAtWitchWeTriedToCall > 1000) { if (now - timeAtWitchWeTriedToCall > 1000) {
Log.e("[Dialer] More than 1 second has passed waiting for network, abort auto call to $addressWaitingNetworkToBeCalled") Log.e("[Dialer] More than 1 second has passed waiting for network, abort auto call to $address")
enteredUri.value = addressWaitingNetworkToBeCalled enteredUri.value = address
} else { } else {
Log.i("[Dialer] Network is available, continue auto call to $addressWaitingNetworkToBeCalled") Log.i("[Dialer] Network is available, continue auto call to $address")
coreContext.startCall(addressWaitingNetworkToBeCalled.orEmpty()) coreContext.startCall(address)
} }
addressWaitingNetworkToBeCalled = null addressWaitingNetworkToBeCalled = null