Fixed SSO login from QRcode

This commit is contained in:
Sylvain Berfini 2025-03-11 14:21:29 +01:00
parent a99067f701
commit 5d14d8bb7b

View file

@ -38,6 +38,7 @@ import org.linphone.databinding.AssistantQrCodeScannerFragmentBinding
import org.linphone.ui.GenericActivity
import org.linphone.ui.GenericFragment
import org.linphone.ui.assistant.viewmodel.QrCodeViewModel
import org.linphone.ui.main.sso.fragment.SingleSignOnFragmentDirections
@UiThread
class QrCodeScannerFragment : GenericFragment() {
@ -98,6 +99,24 @@ class QrCodeScannerFragment : GenericFragment() {
}
}
coreContext.bearerAuthenticationRequestedEvent.observe(viewLifecycleOwner) {
it.consume { pair ->
val serverUrl = pair.first
val username = pair.second
Log.i(
"$TAG Navigating to Single Sign On Fragment with server URL [$serverUrl] and username [$username]"
)
if (findNavController().currentDestination?.id == R.id.qrCodeScannerFragment) {
val action = SingleSignOnFragmentDirections.actionGlobalSingleSignOnFragment(
serverUrl,
username
)
findNavController().navigate(action)
}
}
}
if (!isCameraPermissionGranted()) {
if (ActivityCompat.shouldShowRequestPermissionRationale(requireActivity(), Manifest.permission.CAMERA)) {
Log.w("$TAG CAMERA permission wasn't granted yet, asking for it now")