varroa: strip Wigle integration (deferred, not in base stack)
This commit is contained in:
parent
672fbbe324
commit
992628df02
1 changed files with 0 additions and 143 deletions
|
|
@ -30,7 +30,6 @@ import androidx.compose.ui.unit.sp
|
||||||
import androidx.compose.material.icons.filled.Link
|
import androidx.compose.material.icons.filled.Link
|
||||||
import androidx.compose.material.icons.filled.Wifi
|
import androidx.compose.material.icons.filled.Wifi
|
||||||
import androidx.compose.material.icons.filled.Terminal
|
import androidx.compose.material.icons.filled.Terminal
|
||||||
import androidx.compose.material.icons.filled.NetworkCheck
|
|
||||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
import androidx.compose.ui.text.input.VisualTransformation
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
|
|
@ -68,14 +67,8 @@ fun SettingsScreen(
|
||||||
val sshStatus by vm.sshStatus.collectAsState()
|
val sshStatus by vm.sshStatus.collectAsState()
|
||||||
val wifiStatus by vm.wifiStatus.collectAsState()
|
val wifiStatus by vm.wifiStatus.collectAsState()
|
||||||
val wifiConnectResult by vm.wifiConnectResult.collectAsState()
|
val wifiConnectResult by vm.wifiConnectResult.collectAsState()
|
||||||
val wigleStatus by vm.wigleStatus.collectAsState()
|
|
||||||
val wigleStats by vm.wigleStats.collectAsState()
|
|
||||||
val wigleConfigResult by vm.wigleConfigResult.collectAsState()
|
|
||||||
|
|
||||||
// WiGLE config input state
|
// WiGLE config input state
|
||||||
var wigleEnabled by remember(wigleStatus) { mutableStateOf(wigleStatus?.enabled ?: false) }
|
|
||||||
var wigleApiName by remember { mutableStateOf("") }
|
|
||||||
var wigleApiToken by remember { mutableStateOf("") }
|
|
||||||
|
|
||||||
// WiFi config input state
|
// WiFi config input state
|
||||||
var homeWifiSsid by remember { mutableStateOf("") }
|
var homeWifiSsid by remember { mutableStateOf("") }
|
||||||
|
|
@ -307,132 +300,6 @@ fun SettingsScreen(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── WiGLE Wardriving ──────────────────────────────────────────────
|
|
||||||
SettingsSection("WIGLE WARDRIVING") {
|
|
||||||
if (!isPaired) {
|
|
||||||
Text("Pair device first to configure WiGLE",
|
|
||||||
color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
} else {
|
|
||||||
// Enable toggle
|
|
||||||
Row(
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
) {
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
|
||||||
Icon(Icons.Default.NetworkCheck, contentDescription = null,
|
|
||||||
tint = if (wigleStatus?.enabled == true) Amber else Color.Gray,
|
|
||||||
modifier = Modifier.size(16.dp))
|
|
||||||
Spacer(Modifier.width(8.dp))
|
|
||||||
Column {
|
|
||||||
Text("WiFi Scanning",
|
|
||||||
color = Color.White, fontFamily = FontFamily.Monospace, fontSize = 12.sp)
|
|
||||||
Text("Scan networks & upload to WiGLE",
|
|
||||||
color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Switch(
|
|
||||||
checked = wigleEnabled,
|
|
||||||
onCheckedChange = { wigleEnabled = it },
|
|
||||||
colors = SwitchDefaults.colors(checkedThumbColor = Background, checkedTrackColor = Amber)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(Modifier.height(12.dp))
|
|
||||||
|
|
||||||
// API credentials
|
|
||||||
Text("WiGLE Account", color = Amber, fontFamily = FontFamily.Monospace,
|
|
||||||
fontWeight = FontWeight.Bold, fontSize = 10.sp, letterSpacing = 1.sp)
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
|
|
||||||
if (wigleStatus?.apiName?.isNotBlank() == true) {
|
|
||||||
Text("Configured: ${wigleStatus?.apiName}",
|
|
||||||
color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
Spacer(Modifier.height(4.dp))
|
|
||||||
}
|
|
||||||
|
|
||||||
OutlinedTextField(
|
|
||||||
value = wigleApiName,
|
|
||||||
onValueChange = { wigleApiName = it },
|
|
||||||
label = { Text("API Name", fontFamily = FontFamily.Monospace, fontSize = 11.sp) },
|
|
||||||
placeholder = { Text("From wigle.net → Account → API", color = Color.Gray, fontSize = 10.sp) },
|
|
||||||
singleLine = true,
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
colors = OutlinedTextFieldDefaults.colors(
|
|
||||||
focusedBorderColor = Amber, unfocusedBorderColor = SurfaceVariant,
|
|
||||||
focusedLabelColor = Amber, unfocusedLabelColor = Color.Gray,
|
|
||||||
cursorColor = Amber, focusedTextColor = OnSurface, unfocusedTextColor = OnSurface
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
OutlinedTextField(
|
|
||||||
value = wigleApiToken,
|
|
||||||
onValueChange = { wigleApiToken = it },
|
|
||||||
label = { Text("API Token", fontFamily = FontFamily.Monospace, fontSize = 11.sp) },
|
|
||||||
placeholder = { Text("●●●●●●●●●●●●", color = Color.Gray, fontSize = 10.sp) },
|
|
||||||
singleLine = true,
|
|
||||||
visualTransformation = PasswordVisualTransformation(),
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
colors = OutlinedTextFieldDefaults.colors(
|
|
||||||
focusedBorderColor = Amber, unfocusedBorderColor = SurfaceVariant,
|
|
||||||
focusedLabelColor = Amber, unfocusedLabelColor = Color.Gray,
|
|
||||||
cursorColor = Amber, focusedTextColor = OnSurface, unfocusedTextColor = OnSurface
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
wigleConfigResult?.let {
|
|
||||||
Text(it, color = if (it.startsWith("Failed")) Color.Red else Amber,
|
|
||||||
fontFamily = FontFamily.Monospace, fontSize = 11.sp)
|
|
||||||
Spacer(Modifier.height(4.dp))
|
|
||||||
}
|
|
||||||
|
|
||||||
Button(
|
|
||||||
onClick = { vm.setWigleConfig(wigleEnabled, wigleApiName, wigleApiToken) },
|
|
||||||
enabled = wigleApiName.isNotBlank() && wigleApiToken.isNotBlank(),
|
|
||||||
colors = ButtonDefaults.buttonColors(containerColor = Amber, contentColor = Background),
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
) {
|
|
||||||
Text("Save WiGLE Config", fontFamily = FontFamily.Monospace, fontWeight = FontWeight.Bold)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stats (when enabled)
|
|
||||||
if (wigleStatus?.enabled == true) {
|
|
||||||
Spacer(Modifier.height(12.dp))
|
|
||||||
HorizontalDivider(color = SurfaceVariant)
|
|
||||||
Spacer(Modifier.height(12.dp))
|
|
||||||
|
|
||||||
Text("Statistics", color = Amber, fontFamily = FontFamily.Monospace,
|
|
||||||
fontWeight = FontWeight.Bold, fontSize = 10.sp, letterSpacing = 1.sp)
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
|
|
||||||
Row(modifier = Modifier.fillMaxWidth()) {
|
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
|
||||||
Text("Networks Found", color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
Text("${wigleStats?.totalNetworks ?: wigleStatus?.totalNetworks ?: 0}",
|
|
||||||
color = Color.White, fontFamily = FontFamily.Monospace, fontSize = 14.sp, fontWeight = FontWeight.Bold)
|
|
||||||
}
|
|
||||||
Column(modifier = Modifier.weight(1f)) {
|
|
||||||
Text("Pending Upload", color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
Text("${wigleStats?.pendingUpload ?: wigleStatus?.pendingUpload ?: 0}",
|
|
||||||
color = Color.White, fontFamily = FontFamily.Monospace, fontSize = 14.sp, fontWeight = FontWeight.Bold)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Spacer(Modifier.height(8.dp))
|
|
||||||
|
|
||||||
wigleStatus?.lastScan?.let { ts ->
|
|
||||||
val ago = formatTimeAgo(ts)
|
|
||||||
Text("Last scan: $ago", color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
}
|
|
||||||
wigleStatus?.lastUpload?.let { ts ->
|
|
||||||
val ago = formatTimeAgo(ts)
|
|
||||||
Text("Last upload: $ago", color = Color.Gray, fontFamily = FontFamily.Monospace, fontSize = 10.sp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsSection("ADAMAPS") {
|
SettingsSection("ADAMAPS") {
|
||||||
SettingsField(
|
SettingsField(
|
||||||
label = "ADAMaps API URL",
|
label = "ADAMaps API URL",
|
||||||
|
|
@ -714,14 +581,4 @@ private fun WalletLinkingSection(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatTimeAgo(timestampSeconds: Long): String {
|
|
||||||
val now = System.currentTimeMillis() / 1000
|
|
||||||
val diff = now - timestampSeconds
|
|
||||||
return when {
|
|
||||||
diff < 60 -> "just now"
|
|
||||||
diff < 3600 -> "${diff / 60} minutes ago"
|
|
||||||
diff < 86400 -> "${diff / 3600} hours ago"
|
|
||||||
else -> "${diff / 86400} days ago"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue