mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
Refactor "Disconnect" and "Track" logic
This commit is contained in:
1 parent
d700432829
commit
f9b1a97a37
3 files changed
+26
-21
No files matched your search
+8
-6
@@ -473,12 +473,14 @@ fun RadioControlDialog(
|
||||
// If current baud rate is not in the new list, default to the first available
|
||||
if (baudRate.intValue !in baudRates) baudRate.intValue = baudRates.first()
|
||||
|
||||
val pairedDevices = remember {
|
||||
try {
|
||||
val manager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
||||
manager.adapter?.bondedDevices?.map { it.name ?: "Unknown" to it.address } ?: emptyList()
|
||||
} catch (_: SecurityException) {
|
||||
emptyList()
|
||||
val pairedDevices: List<Pair<String, String>> = remember {
|
||||
buildList {
|
||||
try {
|
||||
val manager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
|
||||
manager.adapter?.bondedDevices?.forEach {
|
||||
add(Pair(it.name ?: "Unknown", it.address ?: ""))
|
||||
}
|
||||
} catch (_: SecurityException) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user