Skip to content

Commit f96b632

Browse files
authored
android: emphasize hex code in TV login (#578)
Add a rounded box around the hex code and emphasize the code with font/styling Updates tailscale/corp#24837 Signed-off-by: kari-ts <[email protected]>
1 parent 7fc51f5 commit f96b632

File tree

2 files changed

+28
-11
lines changed

2 files changed

+28
-11
lines changed

android/src/main/java/com/tailscale/ipn/ui/view/LoginQRView.kt

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import androidx.compose.ui.Alignment
2525
import androidx.compose.ui.Modifier
2626
import androidx.compose.ui.draw.clip
2727
import androidx.compose.ui.res.stringResource
28+
import androidx.compose.ui.text.font.FontWeight
29+
import androidx.compose.ui.text.style.TextAlign
2830
import androidx.compose.ui.tooling.preview.Preview
2931
import androidx.compose.ui.unit.dp
3032
import androidx.compose.ui.window.Dialog
@@ -41,7 +43,6 @@ fun LoginQRView(onDismiss: () -> Unit = {}, model: LoginQRViewModel = viewModel(
4143
Dialog(onDismissRequest = onDismiss) {
4244
val image by model.qrCode.collectAsState()
4345
val numCode by model.numCode.collectAsState()
44-
4546
Column(
4647
modifier =
4748
Modifier.clip(RoundedCornerShape(10.dp))
@@ -52,12 +53,13 @@ fun LoginQRView(onDismiss: () -> Unit = {}, model: LoginQRViewModel = viewModel(
5253
Text(
5354
text = stringResource(R.string.scan_to_connect_to_your_tailnet),
5455
style = MaterialTheme.typography.titleMedium,
55-
color = MaterialTheme.colorScheme.onSurface)
56+
color = MaterialTheme.colorScheme.onSurface,
57+
textAlign = TextAlign.Center)
58+
5659
Box(
5760
modifier =
5861
Modifier.size(200.dp)
59-
.background(MaterialTheme.colorScheme.onSurface)
60-
.fillMaxWidth(),
62+
.background(MaterialTheme.colorScheme.onSurface),
6163
contentAlignment = Alignment.Center) {
6264
image?.let {
6365
Image(
@@ -66,13 +68,28 @@ fun LoginQRView(onDismiss: () -> Unit = {}, model: LoginQRViewModel = viewModel(
6668
modifier = Modifier.fillMaxSize())
6769
}
6870
}
69-
numCode?.let { it ->
70-
Text(
71-
text = stringResource(R.string.enter_code_to_connect_to_tailnet, it),
72-
style = MaterialTheme.typography.titleMedium,
73-
color = MaterialTheme.colorScheme.onSurface)
71+
Text(
72+
text = stringResource(R.string.enter_code_to_connect_to_tailnet),
73+
style = MaterialTheme.typography.bodyMedium,
74+
color = MaterialTheme.colorScheme.onSurface)
75+
76+
numCode?.let {
77+
Box(
78+
modifier =
79+
Modifier
80+
.clip(RoundedCornerShape(6.dp))
81+
.background(MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)),
82+
contentAlignment = Alignment.Center) {
83+
Text(
84+
text =it,
85+
style =
86+
MaterialTheme.typography.bodyLarge.copy(fontWeight = FontWeight.Bold),
87+
color = MaterialTheme.colorScheme.onSurface)
88+
}
89+
}
90+
Button(onClick = onDismiss, modifier = Modifier.padding(top = 16.dp)) {
91+
Text(text = stringResource(R.string.dismiss))
7492
}
75-
Button(onClick = onDismiss) { Text(text = stringResource(R.string.dismiss)) }
7693
}
7794
}
7895
}

android/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
<string name="welcome1">Tailscale is a mesh VPN for securely connecting your devices.</string>
245245
<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>
246246
<string name="scan_to_connect_to_your_tailnet">Scan this QR code to log in to your tailnet</string>
247-
<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>
247+
<string name="enter_code_to_connect_to_tailnet">or enter this code in the Machines > Add device section of the admin console: </string>
248248

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

0 commit comments

Comments
 (0)