Commit 0d4846fc authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

Improve user alerting when unable to call device

parent a1afb74e
......@@ -31,6 +31,10 @@ import android.telephony.PhoneStateListener
import android.telephony.TelephonyManager
import android.util.TypedValue
import android.view.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import org.linhome.LinhomeApplication
import org.linhome.LinhomeApplication.Companion.corePreferences
import org.linhome.R
......@@ -181,7 +185,10 @@ class CoreContext(val context: Context, coreConfig: Config) {
}
}
if (state == Call.State.Error && call.callLog?.dir == Call.Dir.Outgoing) {
DialogUtil.error("unable_to_call_device")
GlobalScope.launch(context = Dispatchers.Main) {
delay(250)
DialogUtil.error("unable_to_call_device")
}
}
}
}
......
......@@ -51,10 +51,6 @@ class CallOutgoingActivity : CallGenericActivity() {
callViewModel.callState.observe(this, Observer { callState ->
when (callState) {
Call.State.OutgoingInit, Call.State.OutgoingProgress, Call.State.OutgoingRinging, Call.State.OutgoingEarlyMedia -> return@Observer
Call.State.Error -> {
DialogUtil.error("unable_to_call_device")
finish()
}
else -> finish()
}
})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment