Bundle tor (#339)

* tor started

* tor works

* tor code

* improve manager

* works

* move tor icon

* werks

* arti works

* arti works

* arti works with reconnect

* delay fix

* refactor
This commit is contained in:
callebtc
2025-08-29 14:37:35 +02:00
committed by GitHub
parent 7f4bd96739
commit 686e2e78ec
12 changed files with 551 additions and 16 deletions
@@ -48,6 +48,27 @@ fun isFavoriteReactive(
}
}
@Composable
fun TorStatusIcon(
modifier: Modifier = Modifier
) {
val torStatus by com.bitchat.android.net.TorManager.statusFlow.collectAsState()
if (torStatus.mode != com.bitchat.android.net.TorMode.OFF) {
val cableColor = when {
torStatus.running && torStatus.bootstrapPercent < 100 -> Color(0xFFFF9500)
torStatus.running && torStatus.bootstrapPercent >= 100 -> Color(0xFF00C851)
else -> Color.Red
}
Icon(
imageVector = Icons.Outlined.Cable,
contentDescription = "Tor status",
modifier = modifier,
tint = cableColor
)
}
}
@Composable
fun NoiseSessionIcon(
sessionState: String?,
@@ -539,9 +560,12 @@ private fun MainHeader(
// Right section with location channels button and peer counter
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(10.dp)
horizontalArrangement = Arrangement.spacedBy(5.dp)
) {
// Tor status cable icon when Tor is enabled
TorStatusIcon(modifier = Modifier.size(15.dp))
// Location channels button (matching iOS implementation)
LocationChannelsButton(
viewModel = viewModel,