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 <kari@tailscale.com>
pull/537/head
kari-ts 2 months ago committed by GitHub
parent cd993fee43
commit d309f31b5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -22,21 +22,26 @@ class LoginQRViewModel : IpnViewModel() {
val numCode: StateFlow<String?> = MutableStateFlow(null) val numCode: StateFlow<String?> = MutableStateFlow(null)
val qrCode: StateFlow<ImageBitmap?> = MutableStateFlow(null) val qrCode: StateFlow<ImageBitmap?> = MutableStateFlow(null)
// Remove this once changes to admin console allowing input code to be entered are made.
val codeEnabled = false
init { init {
viewModelScope.launch { viewModelScope.launch {
Notifier.browseToURL.collect { url -> Notifier.browseToURL.collect { url ->
url?.let { url?.let {
qrCode.set(generateQRCode(url, 200, 0)) qrCode.set(generateQRCode(url, 200, 0))
// Extract the string after "https://login.tailscale.com/a/"
val prefix = "https://login.tailscale.com/a/" if (codeEnabled) {
val code = // Extract the string after "https://login.tailscale.com/a/"
if (it.startsWith(prefix)) { val prefix = "https://login.tailscale.com/a/"
it.removePrefix(prefix) val code =
} else { if (it.startsWith(prefix)) {
null it.removePrefix(prefix)
} } else {
numCode.set(code) null
}
numCode.set(code)
}
} }
?: run { ?: run {
qrCode.set(null) qrCode.set(null)

Loading…
Cancel
Save