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
if (currentCall == null) {
currentCallViewModel.value?.destroy()
currentCallViewModel.value = null
} else if (currentCallViewModel.value == null) {
} else if (currentCallViewModel.value?.call != currentCall) {
currentCallViewModel.value = CallViewModel(currentCall)
}

View file

@ -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