Skip to content

Commit

Permalink
android/ui: remove switch and status label on TV before login (#430)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
barnstar committed Jun 20, 2024
1 parent 9ae30c0 commit 811641f
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions android/src/main/java/com/tailscale/ipn/ui/view/MainView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,22 @@ fun MainView(
val disableToggle by MDMSettings.forceEnabled.flow.collectAsState(initial = true)
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(
colors = MaterialTheme.colorScheme.surfaceContainerListItem,
leadingContent = {
TintedSwitch(
onCheckedChange = {
if (!disableToggle) {
viewModel.toggleVpn()
}
},
enabled = !disableToggle,
checked = isOn)
if (!hideHeader) {
TintedSwitch(
onCheckedChange = {
if (!disableToggle) {
viewModel.toggleVpn()
}
},
enabled = !disableToggle,
checked = isOn)
}
},
headlineContent = {
user?.NetworkProfile?.DomainName?.let { domain ->
Expand All @@ -151,7 +156,9 @@ fun MainView(
}
},
supportingContent = {
Text(text = stateStr, style = MaterialTheme.typography.bodyMedium.short)
if (!hideHeader) {
Text(text = stateStr, style = MaterialTheme.typography.bodyMedium.short)
}
},
trailingContent = {
Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.CenterEnd) {
Expand Down

0 comments on commit 811641f

Please sign in to comment.