mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-09 21:16:04 +00:00
hosts ordering and fixes
This commit is contained in:
@@ -616,18 +616,32 @@ private fun DevicePickerRow(
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
val activeHost = remoteHosts.firstOrNull { h -> h.activeHost }
|
||||
|
||||
if (activeHost != null) {
|
||||
val connecting = rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
if (localDeviceActive) {
|
||||
DevicePill(
|
||||
active = true,
|
||||
icon = painterResource(MR.images.ic_desktop),
|
||||
text = stringResource(MR.strings.this_device),
|
||||
actionButtonVisible = false
|
||||
icon = painterResource(MR.images.ic_smartphone_300),
|
||||
text = activeHost.hostDeviceName,
|
||||
actionButtonVisible = activeHost.sessionState is RemoteHostSessionState.Connected,
|
||||
onActionButtonClick = { onRemoteHostActionButtonClick(activeHost) }
|
||||
) {
|
||||
onLocalDeviceClick()
|
||||
onRemoteHostClick(activeHost, connecting)
|
||||
}
|
||||
}
|
||||
remoteHosts.filter { h -> h.activeHost }.forEach { h ->
|
||||
|
||||
DevicePill(
|
||||
active = localDeviceActive,
|
||||
icon = painterResource(MR.images.ic_desktop),
|
||||
text = stringResource(MR.strings.this_device),
|
||||
actionButtonVisible = false
|
||||
) {
|
||||
onLocalDeviceClick()
|
||||
}
|
||||
|
||||
remoteHosts.filter { h -> h.sessionState is RemoteHostSessionState.Connected && !h.activeHost }.forEach { h ->
|
||||
val connecting = rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
DevicePill(
|
||||
@@ -640,17 +654,6 @@ private fun DevicePickerRow(
|
||||
onRemoteHostClick(h, connecting)
|
||||
}
|
||||
}
|
||||
|
||||
if (!localDeviceActive) {
|
||||
DevicePill(
|
||||
active = false,
|
||||
icon = painterResource(MR.images.ic_desktop),
|
||||
text = stringResource(MR.strings.this_device),
|
||||
actionButtonVisible = false
|
||||
) {
|
||||
onLocalDeviceClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user