feat: Enhance packet handling logging to notify number of waiters and catch errors
This commit is contained in:
@@ -190,6 +190,9 @@ fun ChatsListScreen(
|
||||
var showDevConsole by remember { mutableStateOf(false) }
|
||||
var titleClickCount by remember { mutableStateOf(0) }
|
||||
var lastClickTime by remember { mutableStateOf(0L) }
|
||||
|
||||
// Status dialog state
|
||||
var showStatusDialog by remember { mutableStateOf(false) }
|
||||
|
||||
// Search state - используем ViewModel для поиска пользователей
|
||||
val searchViewModel = remember { SearchUsersViewModel() }
|
||||
@@ -225,13 +228,59 @@ fun ChatsListScreen(
|
||||
)
|
||||
}
|
||||
*/
|
||||
|
||||
// Status dialog
|
||||
if (showStatusDialog) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showStatusDialog = false },
|
||||
title = { Text("Connection Status", fontWeight = FontWeight.Bold) },
|
||||
text = {
|
||||
Column {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(12.dp)
|
||||
.clip(CircleShape)
|
||||
.background(
|
||||
when (protocolState) {
|
||||
ProtocolState.AUTHENTICATED -> Color(0xFF4CAF50)
|
||||
ProtocolState.CONNECTING, ProtocolState.CONNECTED, ProtocolState.HANDSHAKING -> Color(0xFFFFC107)
|
||||
ProtocolState.DISCONNECTED -> Color(0xFFF44336)
|
||||
}
|
||||
)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
Text(
|
||||
text = when (protocolState) {
|
||||
ProtocolState.DISCONNECTED -> "Disconnected"
|
||||
ProtocolState.CONNECTING -> "Connecting..."
|
||||
ProtocolState.CONNECTED -> "Connected"
|
||||
ProtocolState.HANDSHAKING -> "Authenticating..."
|
||||
ProtocolState.AUTHENTICATED -> "Authenticated"
|
||||
},
|
||||
fontSize = 16.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
confirmButton = {
|
||||
Button(onClick = { showStatusDialog = false }) {
|
||||
Text("OK")
|
||||
}
|
||||
},
|
||||
containerColor = if (isDarkTheme) Color(0xFF212121) else Color.White
|
||||
)
|
||||
}
|
||||
|
||||
// Simple background
|
||||
Box(modifier = Modifier.fillMaxSize().background(backgroundColor)) {
|
||||
ModalNavigationDrawer(
|
||||
drawerState = drawerState,
|
||||
drawerContent = {
|
||||
ModalDrawerSheet(drawerContainerColor = drawerBackgroundColor) {
|
||||
ModalDrawerSheet(
|
||||
drawerContainerColor = drawerBackgroundColor,
|
||||
modifier = Modifier.width(280.dp)
|
||||
) {
|
||||
// Drawer Header
|
||||
Column(
|
||||
modifier =
|
||||
@@ -319,7 +368,7 @@ fun ChatsListScreen(
|
||||
selected = false,
|
||||
colors = drawerItemColors,
|
||||
onClick = {
|
||||
scope.launch { drawerState.close() }
|
||||
// Don't close drawer when toggling theme
|
||||
onToggleTheme()
|
||||
}
|
||||
)
|
||||
@@ -410,7 +459,7 @@ fun ChatsListScreen(
|
||||
Box(modifier = Modifier.fillMaxWidth()) {
|
||||
// Title - Triple click to open dev console (stays in place, just fades)
|
||||
if (titleAlpha > 0.01f) {
|
||||
Column(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.clickable {
|
||||
val currentTime =
|
||||
@@ -435,7 +484,8 @@ fun ChatsListScreen(
|
||||
lastClickTime =
|
||||
currentTime
|
||||
}
|
||||
.graphicsLayer { alpha = titleAlpha }
|
||||
.graphicsLayer { alpha = titleAlpha },
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
"Rosetta",
|
||||
@@ -443,32 +493,23 @@ fun ChatsListScreen(
|
||||
fontSize = 20.sp,
|
||||
color = textColor
|
||||
)
|
||||
if (protocolState !=
|
||||
ProtocolState.AUTHENTICATED
|
||||
) {
|
||||
Text(
|
||||
text =
|
||||
when (protocolState) {
|
||||
ProtocolState
|
||||
.DISCONNECTED ->
|
||||
"Connecting..."
|
||||
ProtocolState
|
||||
.CONNECTING ->
|
||||
"Connecting..."
|
||||
ProtocolState
|
||||
.CONNECTED ->
|
||||
"Authenticating..."
|
||||
ProtocolState
|
||||
.HANDSHAKING ->
|
||||
"Authenticating..."
|
||||
ProtocolState
|
||||
.AUTHENTICATED ->
|
||||
""
|
||||
},
|
||||
fontSize = 12.sp,
|
||||
color = secondaryTextColor
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
// Status indicator dot
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.size(10.dp)
|
||||
.clip(CircleShape)
|
||||
.background(
|
||||
when (protocolState) {
|
||||
ProtocolState.AUTHENTICATED -> Color(0xFF4CAF50) // Green
|
||||
ProtocolState.CONNECTING, ProtocolState.CONNECTED, ProtocolState.HANDSHAKING -> Color(0xFFFFC107) // Yellow
|
||||
ProtocolState.DISCONNECTED -> Color(0xFFF44336) // Red
|
||||
}
|
||||
)
|
||||
.clickable {
|
||||
showStatusDialog = true
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user