Commit 14cc2869 authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

Fix QR Code remote prov + cosmetics


Former-commit-id: dbae3d86b522284897f0e67b28886a0fc8e04c04
parent b3b52d5b
......@@ -65,26 +65,25 @@ object Account {
xmlRpcRequest?.setListener { request ->
val status = request.status
val responseValues = request.listResponse
cdlog("Status : ${request.status} listResponse size : ${request.listResponse.size} ")
if (request.status == XmlRpcStatus.Ok) {
val pushGw = coreContext.core.createProxyConfig()
pushGw.idkey = PUSH_GW_ID_KEY
pushGw.enableRegister(true)
pushGw.enablePublish(false)
pushGw.expires = 31536000
pushGw.serverAddr = "sips:${responseValues.get(1)};transport=tls"
pushGw.setRoutes(arrayOf(pushGw.serverAddr))
pushGw.isPushNotificationAllowed = true
coreContext.core.createAddress("sip:${responseValues.get(0)}@${responseValues.get(1)}")?.let {
pushGw.setIdentityAddress(it)
}
val authInfo = Factory.instance().createAuthInfo(responseValues.get(0),responseValues.get(0),null,responseValues.get(2),responseValues.get(1),responseValues.get(1))
coreContext.core.addAuthInfo(authInfo)
coreContext.core.addProxyConfig(pushGw)
linkProxiesWithPushGateway(pushReady)
} else {
pushReady.value = false
val pushGw = coreContext.core.createProxyConfig()
pushGw.idkey = PUSH_GW_ID_KEY
pushGw.enableRegister(true)
pushGw.enablePublish(false)
pushGw.expires = 31536000
pushGw.serverAddr = "sips:${responseValues.get(1)};transport=tls"
pushGw.setRoutes(arrayOf(pushGw.serverAddr))
pushGw.isPushNotificationAllowed = true
coreContext.core.createAddress("sip:${responseValues.get(0)}@${responseValues.get(1)}")?.let {
pushGw.setIdentityAddress(it)
}
val authInfo = Factory.instance().createAuthInfo(responseValues.get(0),responseValues.get(0),null,responseValues.get(2),responseValues.get(1),responseValues.get(1))
coreContext.core.addAuthInfo(authInfo)
coreContext.core.addProxyConfig(pushGw)
linkProxiesWithPushGateway(pushReady)
} else {
pushReady.value = false
}
}
if (xmlRpcRequest != null) {
xmlRpcSession?.sendRequest(xmlRpcRequest)
......
......@@ -2,6 +2,9 @@ package org.lindoor.ui.assistant.remote
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.lindoor.LindoorApplication.Companion.coreContext
import org.lindoor.entities.Account
import org.linphone.core.ConfiguringState
......@@ -11,8 +14,7 @@ import org.linphone.core.CoreListenerStub
class RemoteAnyAccountViewModel : ViewModel() {
var url: Pair<MutableLiveData<String>, MutableLiveData<Boolean>> =
Pair(MutableLiveData<String>(), MutableLiveData<Boolean>(false))
var url: Pair<MutableLiveData<String>, MutableLiveData<Boolean>> = Pair(MutableLiveData(), MutableLiveData(false))
var configurationResult = MutableLiveData<ConfiguringState>()
val pushReady = MutableLiveData<Boolean>()
......@@ -30,8 +32,12 @@ class RemoteAnyAccountViewModel : ViewModel() {
}
override fun onQrcodeFound(core: Core, qr: String) {
url.first.value = qr
startRemoteProvisionning()
GlobalScope.launch(context = Dispatchers.Main) {
coreContext.core.enableQrcodeVideoPreview(false)
coreContext.core.enableVideoPreview(false)
url.first.value = qr
startRemoteProvisionning()
}
}
}
......
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