mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-24 23:45:19 +00:00
wip: select bridges
This commit is contained in:
@@ -77,6 +77,9 @@ object TorManager {
|
||||
fun init(application: Application) {
|
||||
if (initialized) return
|
||||
synchronized(this) {
|
||||
// Initialize bridge prefs once
|
||||
try { TorBridgePreferenceManager.init(application) } catch (_: Throwable) {}
|
||||
|
||||
if (initialized) return
|
||||
initialized = true
|
||||
currentApplication = application
|
||||
@@ -178,6 +181,17 @@ object TorManager {
|
||||
.setSocksPort(currentSocksPort)
|
||||
.setDnsPort(currentSocksPort + 1)
|
||||
.setLogListener(logListener)
|
||||
.apply {
|
||||
// Apply bridge settings
|
||||
val bridgesEnabled = TorBridgePreferenceManager.isEnabled(application)
|
||||
if (bridgesEnabled) {
|
||||
val bridgeLines = TorBridgePreferenceManager.getLines(application)
|
||||
if (bridgeLines.isNotEmpty()) {
|
||||
setBridgeLines(bridgeLines)
|
||||
Log.i(TAG, "Using ${bridgeLines.size} bridge(s): ${bridgeLines.joinToString("; ")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
.build()
|
||||
|
||||
artiProxyRef.set(proxy)
|
||||
|
||||
@@ -108,6 +108,43 @@ fun AboutSheet(
|
||||
}
|
||||
}
|
||||
|
||||
// Tor Bridges section (minimal)
|
||||
item {
|
||||
var showBridgeSheet by remember { mutableStateOf(false) }
|
||||
if (showBridgeSheet) {
|
||||
TorBridgeSheet(
|
||||
isPresented = true,
|
||||
onDismiss = { showBridgeSheet = false }
|
||||
)
|
||||
}
|
||||
Column(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "tor bridges",
|
||||
fontSize = 12.sp,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
fontWeight = FontWeight.Medium,
|
||||
color = colorScheme.onSurface.copy(alpha = 0.8f)
|
||||
)
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Button(
|
||||
onClick = { showBridgeSheet = true },
|
||||
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFFFF9500).copy(alpha = 0.15f)),
|
||||
) {
|
||||
Text("manage bridges", fontFamily = FontFamily.Monospace, color = colorScheme.onSurface)
|
||||
}
|
||||
}
|
||||
Text(
|
||||
text = "add custom bridge lines for censored networks.",
|
||||
fontSize = 10.sp,
|
||||
fontFamily = FontFamily.Monospace,
|
||||
color = colorScheme.onSurface.copy(alpha = 0.6f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Features section
|
||||
item {
|
||||
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
|
||||
Reference in New Issue
Block a user