Skip to content

Commit

Permalink
android: don't show hex code yet (#536)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kari-ts authored Oct 9, 2024
1 parent cd993fe commit d309f31
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ class LoginQRViewModel : IpnViewModel() {

val numCode: StateFlow<String?> = 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 {
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)
Expand Down

0 comments on commit d309f31

Please sign in to comment.