Show the myTeamSpeak ID, UUID and creation date in the account tab
The ID is the account's base32 myTeamSpeak ID: the localpart of its chat ID and the user the myTeamSpeak file API addresses. All three come from the sign-in reply already fetched, on desktop and Android. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material3.Button
|
||||
@@ -41,11 +42,15 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.ts3client.android.SessionController
|
||||
import com.ts3client.myts.AccountInfo
|
||||
import com.ts3client.myts.MyTeamSpeak
|
||||
import com.ts3client.myts.MyTsException
|
||||
import com.ts3client.teamspeak.SyncItem
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.IOException
|
||||
import java.time.ZoneId
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.format.FormatStyle
|
||||
|
||||
private data class ItemRow(val item: SyncItem, val imported: Boolean, val selected: Boolean)
|
||||
|
||||
@@ -64,11 +69,13 @@ fun MyTeamSpeakScreen(vm: SessionController, onBack: () -> Unit) {
|
||||
var error by remember { mutableStateOf(false) }
|
||||
var email by remember { mutableStateOf("") }
|
||||
var password by remember { mutableStateOf("") }
|
||||
var info by remember { mutableStateOf<AccountInfo?>(null) }
|
||||
var all by remember { mutableStateOf(emptyList<SyncItem>()) }
|
||||
var rows by remember { mutableStateOf(emptyList<ItemRow>()) }
|
||||
BackHandler(onBack = onBack)
|
||||
|
||||
fun show(account: MyTeamSpeak.Account) {
|
||||
info = account.info()
|
||||
all = account.items()
|
||||
rows = all.filter { it !is SyncItem.Folder }.map {
|
||||
val imported = vm.isImported(it)
|
||||
@@ -157,10 +164,20 @@ fun MyTeamSpeakScreen(vm: SessionController, onBack: () -> Unit) {
|
||||
signedIn = false
|
||||
rows = emptyList()
|
||||
all = emptyList()
|
||||
info = null
|
||||
message = null
|
||||
}) { Text("Sign out") }
|
||||
}
|
||||
}
|
||||
info?.let { details ->
|
||||
item {
|
||||
Column(Modifier.padding(horizontal = 16.dp)) {
|
||||
if (details.userId().isNotEmpty()) Detail("ID", details.userId())
|
||||
if (details.uuid().isNotEmpty()) Detail("UUID", details.uuid())
|
||||
details.created()?.let { Detail("Created", dateFormat.format(it)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rows.isNotEmpty()) {
|
||||
item {
|
||||
Text("Synchronised by the account", Modifier.padding(start = 16.dp, top = 16.dp),
|
||||
@@ -204,6 +221,17 @@ fun MyTeamSpeakScreen(vm: SessionController, onBack: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
private val dateFormat = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).withZone(ZoneId.systemDefault())
|
||||
|
||||
/** A labelled value that can be selected and copied. */
|
||||
@Composable
|
||||
private fun Detail(label: String, value: String) {
|
||||
Column(Modifier.padding(top = 8.dp)) {
|
||||
Text(label, style = MaterialTheme.typography.labelMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
SelectionContainer { Text(value, style = MaterialTheme.typography.bodyMedium) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun name(item: SyncItem) = when (item) {
|
||||
is SyncItem.Bookmark -> item.name().ifBlank { item.address() }
|
||||
is SyncItem.Identity -> "Identity: ${item.name()}"
|
||||
|
||||
Reference in New Issue
Block a user