Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android: emphasize hex code in TV login #578

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions android/src/main/java/com/tailscale/ipn/ui/view/LoginQRView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
Expand All @@ -41,7 +43,6 @@ fun LoginQRView(onDismiss: () -> Unit = {}, model: LoginQRViewModel = viewModel(
Dialog(onDismissRequest = onDismiss) {
val image by model.qrCode.collectAsState()
val numCode by model.numCode.collectAsState()

Column(
modifier =
Modifier.clip(RoundedCornerShape(10.dp))
Expand All @@ -52,12 +53,13 @@ fun LoginQRView(onDismiss: () -> Unit = {}, model: LoginQRViewModel = viewModel(
Text(
text = stringResource(R.string.scan_to_connect_to_your_tailnet),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onSurface)
color = MaterialTheme.colorScheme.onSurface,
textAlign = TextAlign.Center)

Box(
modifier =
Modifier.size(200.dp)
.background(MaterialTheme.colorScheme.onSurface)
.fillMaxWidth(),
.background(MaterialTheme.colorScheme.onSurface),
contentAlignment = Alignment.Center) {
image?.let {
Image(
Expand All @@ -66,13 +68,28 @@ fun LoginQRView(onDismiss: () -> Unit = {}, model: LoginQRViewModel = viewModel(
modifier = Modifier.fillMaxSize())
}
}
numCode?.let { it ->
Text(
text = stringResource(R.string.enter_code_to_connect_to_tailnet, it),
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onSurface)
Text(
text = stringResource(R.string.enter_code_to_connect_to_tailnet),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurface)

numCode?.let {
Box(
modifier =
Modifier
.clip(RoundedCornerShape(6.dp))
.background(MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)),
contentAlignment = Alignment.Center) {
Text(
text =it,
style =
MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold),
color = MaterialTheme.colorScheme.onSurface)
}
}
Button(onClick = onDismiss, modifier = Modifier.padding(top = 16.dp)) {
Text(text = stringResource(R.string.dismiss))
}
Button(onClick = onDismiss) { Text(text = stringResource(R.string.dismiss)) }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<string name="welcome1">Tailscale is a mesh VPN for securely connecting your devices.</string>
<string name="welcome2">All connections are device-to-device, so we never see your data. We collect and use your email address and name, as well as your device name, OS version, and IP address in order to help you to connect your devices and manage your settings. We log when you are connected to your network.</string>
<string name="scan_to_connect_to_your_tailnet">Scan this QR code to log in to your tailnet</string>
<string name="enter_code_to_connect_to_tailnet">or enter this code in the Machines > Add device section of the admin console: \n%1$s</string>
<string name="enter_code_to_connect_to_tailnet">or enter this code in the Machines > Add device section of the admin console: </string>

<!-- Strings for intent handling -->
<string name="vpn_is_not_ready_to_start">VPN is not ready to start</string>
Expand Down
Loading