Android: myTeamSpeak button on the connect screen without bookmarks

With no bookmarks, the connect screen shows "Sign in to myTeamSpeak"
("Import from myTeamSpeak" when signed in), which opens the same
myTeamSpeak screen as Settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 15:26:10 +00:00
co-authored by Claude Opus 5.5
parent cdd41e7527
commit 00d9d85e54
2 changed files with 13 additions and 1 deletions
@@ -31,6 +31,7 @@ fun App(vm: SessionController) {
val snackbar = remember { SnackbarHostState() }
var settingsOpen by rememberSaveable { mutableStateOf(false) }
var contactsOpen by rememberSaveable { mutableStateOf(false) }
var myTeamSpeakOpen by rememberSaveable { mutableStateOf(false) }
var editingContact by rememberSaveable { mutableStateOf<String?>(null) }
// Set when a contact's page was opened from a client, so leaving it goes back there.
var contactDirect by rememberSaveable { mutableStateOf(false) }
@@ -46,6 +47,7 @@ fun App(vm: SessionController) {
connectOpen = false
settingsOpen = false
contactsOpen = false
myTeamSpeakOpen = false
editingBookmark = null
}
}
@@ -87,6 +89,7 @@ fun App(vm: SessionController) {
contactDirect = false
editingContact = uniqueId
}, onBack = { contactsOpen = false })
myTeamSpeakOpen -> MyTeamSpeakScreen(vm, onBack = { myTeamSpeakOpen = false })
settingsOpen -> SettingsScreen(vm, onContacts = { openContacts(null) }, onBack = { settingsOpen = false })
server != null && !connectOpen -> {
serverStates.SaveableStateProvider(server.id) {
@@ -98,7 +101,7 @@ fun App(vm: SessionController) {
}
}
}
else -> ConnectScreen(vm, snackbar, { settingsOpen = true }, connectAsking,
else -> ConnectScreen(vm, snackbar, { settingsOpen = true }, { myTeamSpeakOpen = true }, connectAsking,
onEditBookmark = { editingBookmark = it },
onBack = if (current != null) ({ connectOpen = false }) else null)
}
@@ -30,6 +30,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.IconButton
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
@@ -66,6 +67,7 @@ fun ConnectScreen(
vm: SessionController,
snackbar: SnackbarHostState,
onSettings: () -> Unit,
onMyTeamSpeak: () -> Unit,
onConnect: (() -> Unit) -> Unit,
onEditBookmark: (BookmarkEdit) -> Unit,
/** Back to the servers already connected; null when there are none. */
@@ -74,6 +76,7 @@ fun ConnectScreen(
val lastEnd by vm.lastEnd.collectAsStateWithLifecycle()
val bookmarks by vm.bookmarks.collectAsStateWithLifecycle()
val identities by vm.identities.all.collectAsStateWithLifecycle()
val myTeamSpeakSignedIn by vm.myTeamSpeakSignedIn.collectAsStateWithLifecycle()
var address by rememberSaveable { mutableStateOf(vm.lastAddress) }
var identityId by rememberSaveable { mutableStateOf("") }
var nickname by rememberSaveable { mutableStateOf(vm.nicknameFor("")) }
@@ -133,6 +136,12 @@ fun ConnectScreen(
Text("Bookmarks", Modifier.padding(top = 16.dp), style = MaterialTheme.typography.titleSmall,
color = MaterialTheme.colorScheme.primary)
}
} else {
item {
OutlinedButton(onClick = onMyTeamSpeak, Modifier.padding(top = 16.dp)) {
Text(if (myTeamSpeakSignedIn) "Import from myTeamSpeak" else "Sign in to myTeamSpeak")
}
}
}
itemsIndexed(bookmarks) { index, bookmark ->
BookmarkRow(bookmark, identities, { onConnect { vm.connect(bookmark) } },