android/ui: remove switch and status label on TV before login (#430)

updates tailscale/corp#20930

More fixes.  Google reviewers were unhappy that
there was a non-actionable label for AndroidTV when
before login had happened, so that have been removed.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
pull/431/head
Jonathan Nobels 1 week ago committed by GitHub
parent 9ae30c06bf
commit 811641f538
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -129,17 +129,22 @@ fun MainView(
val disableToggle by MDMSettings.forceEnabled.flow.collectAsState(initial = true) val disableToggle by MDMSettings.forceEnabled.flow.collectAsState(initial = true)
val showKeyExpiry by viewModel.showExpiry.collectAsState(initial = false) val showKeyExpiry by viewModel.showExpiry.collectAsState(initial = false)
// Hide the header only on Android TV when the user needs to login
val hideHeader = (isAndroidTV() && state == Ipn.State.NeedsLogin)
ListItem( ListItem(
colors = MaterialTheme.colorScheme.surfaceContainerListItem, colors = MaterialTheme.colorScheme.surfaceContainerListItem,
leadingContent = { leadingContent = {
TintedSwitch( if (!hideHeader) {
onCheckedChange = { TintedSwitch(
if (!disableToggle) { onCheckedChange = {
viewModel.toggleVpn() if (!disableToggle) {
} viewModel.toggleVpn()
}, }
enabled = !disableToggle, },
checked = isOn) enabled = !disableToggle,
checked = isOn)
}
}, },
headlineContent = { headlineContent = {
user?.NetworkProfile?.DomainName?.let { domain -> user?.NetworkProfile?.DomainName?.let { domain ->
@ -151,7 +156,9 @@ fun MainView(
} }
}, },
supportingContent = { supportingContent = {
Text(text = stateStr, style = MaterialTheme.typography.bodyMedium.short) if (!hideHeader) {
Text(text = stateStr, style = MaterialTheme.typography.bodyMedium.short)
}
}, },
trailingContent = { trailingContent = {
Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.CenterEnd) { Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.CenterEnd) {

Loading…
Cancel
Save