kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
only consider BLE pairing for addressValid
rodzic
c04c1b4add
commit
eb5abb4be9
|
@ -112,15 +112,14 @@ class BluetoothInterface(val service: RadioInterfaceService, val address: String
|
|||
/** Return true if this address is still acceptable. For BLE that means, still bonded */
|
||||
@SuppressLint("NewApi", "MissingPermission")
|
||||
override fun addressValid(context: Context, rest: String): Boolean {
|
||||
val allPaired = if (hasCompanionDeviceApi(context)) {
|
||||
/* val allPaired = if (hasCompanionDeviceApi(context)) {
|
||||
val deviceManager: CompanionDeviceManager by lazy {
|
||||
context.getSystemService(Context.COMPANION_DEVICE_SERVICE) as CompanionDeviceManager
|
||||
}
|
||||
deviceManager.associations.map { it }.toSet()
|
||||
} else {
|
||||
getBluetoothAdapter(context)?.bondedDevices.orEmpty()
|
||||
} else { */
|
||||
val allPaired = getBluetoothAdapter(context)?.bondedDevices.orEmpty()
|
||||
.map { it.address }.toSet()
|
||||
}
|
||||
return if (!allPaired.contains(rest)) {
|
||||
warn("Ignoring stale bond to ${rest.anonymize}")
|
||||
false
|
||||
|
|
|
@ -813,7 +813,7 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
if (curRadio != null && !MockInterface.addressValid(requireContext(), "")) {
|
||||
binding.warningNotPaired.visibility = View.GONE
|
||||
// binding.scanStatusText.text = getString(R.string.current_pair).format(curRadio)
|
||||
} else {
|
||||
} else if (model.bluetoothEnabled.value == true){
|
||||
binding.warningNotPaired.visibility = View.VISIBLE
|
||||
binding.scanStatusText.text = getString(R.string.not_paired_yet)
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue