feat: Implement protocol packet classes and binary stream for network communication
This commit is contained in:
@@ -28,6 +28,8 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.airbnb.lottie.compose.*
|
||||
import com.rosetta.messenger.R
|
||||
import com.rosetta.messenger.network.ProtocolManager
|
||||
import com.rosetta.messenger.network.ProtocolState
|
||||
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -120,6 +122,9 @@ fun ChatsListScreen(
|
||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
// Protocol connection state
|
||||
val protocolState by ProtocolManager.state.collectAsState()
|
||||
|
||||
var visible by remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
@@ -283,11 +288,27 @@ fun ChatsListScreen(
|
||||
|
||||
Spacer(modifier = Modifier.width(12.dp))
|
||||
|
||||
Text(
|
||||
"Rosetta",
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 20.sp
|
||||
)
|
||||
// Title with connection status
|
||||
Column {
|
||||
Text(
|
||||
"Rosetta",
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 20.sp
|
||||
)
|
||||
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
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
|
||||
Reference in New Issue
Block a user