From d309f31b5ab868b79fa1e63e1a00bf4bb090d809 Mon Sep 17 00:00:00 2001 From: kari-ts <135075563+kari-ts@users.noreply.github.com> Date: Tue, 8 Oct 2024 20:02:55 -0700 Subject: [PATCH] android: don't show hex code yet (#536) Hold off on showing the code until there is a place in the admin console for the user to input the code. Updates tailscale/tailscale#13277 Signed-off-by: kari-ts --- .../ipn/ui/viewModel/LoginQRViewModel.kt | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/android/src/main/java/com/tailscale/ipn/ui/viewModel/LoginQRViewModel.kt b/android/src/main/java/com/tailscale/ipn/ui/viewModel/LoginQRViewModel.kt index 34d88dfd90..7499fc0c0f 100644 --- a/android/src/main/java/com/tailscale/ipn/ui/viewModel/LoginQRViewModel.kt +++ b/android/src/main/java/com/tailscale/ipn/ui/viewModel/LoginQRViewModel.kt @@ -22,21 +22,26 @@ class LoginQRViewModel : IpnViewModel() { val numCode: StateFlow = MutableStateFlow(null) val qrCode: StateFlow = MutableStateFlow(null) + // Remove this once changes to admin console allowing input code to be entered are made. + val codeEnabled = false init { viewModelScope.launch { Notifier.browseToURL.collect { url -> url?.let { qrCode.set(generateQRCode(url, 200, 0)) - // Extract the string after "https://login.tailscale.com/a/" - val prefix = "https://login.tailscale.com/a/" - val code = - if (it.startsWith(prefix)) { - it.removePrefix(prefix) - } else { - null - } - numCode.set(code) + + if (codeEnabled) { + // Extract the string after "https://login.tailscale.com/a/" + val prefix = "https://login.tailscale.com/a/" + val code = + if (it.startsWith(prefix)) { + it.removePrefix(prefix) + } else { + null + } + numCode.set(code) + } } ?: run { qrCode.set(null)