Commit 75632d8a authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

Refactoring


Former-commit-id: 78a13d4a12716fd295ffbed88498a0aa3197d862
parent 8c7463c8
......@@ -30,8 +30,9 @@ class RemoteAnyAccountViewModel : ViewModel() {
configurationResult.postValue(status)
}
override fun onQrcodeFound(core: Core, url: String) {
qrCodeFound.postValue(url)
override fun onQrcodeFound(core: Core, qr: String) {
url.first.value = qr
startRemoteProvisionning()
}
}
......@@ -43,6 +44,12 @@ class RemoteAnyAccountViewModel : ViewModel() {
coreContext.core.addListener(coreListener)
}
fun startRemoteProvisionning() {
coreContext.core.provisioningUri = url.first.value
coreContext.core.stop()
coreContext.core.start()
}
override fun onCleared() {
coreContext.core.removeListener(coreListener)
super.onCleared()
......
......@@ -47,12 +47,7 @@ class RemoteQrAccountFragment : GenericFragment() {
} else
DialogUtil.error("failed_creating_pushgateway")
})
model.qrCodeFound.observe(viewLifecycleOwner, Observer { url ->
showProgress()
coreContext.core.provisioningUri = url
coreContext.core.stop()
coreContext.core.start()
})
binding.root.infobutton.setOnClickListener {
binding.root.infotext.toogleVisible()
......
......@@ -52,9 +52,7 @@ class RemoteUrlAccountFragment : GenericFragment() {
})
hideKeyboard()
showProgress()
coreContext.core.provisioningUri = model.url.first.value
coreContext.core.stop()
coreContext.core.start()
model.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