mirror of
https://github.com/home-assistant/android
synced 2024-07-22 10:54:12 +00:00
Only check for beacons if the index is present (#2916)
* Only check for beacons if the index is present * Remove assert * Review comment
This commit is contained in:
parent
1449ff5409
commit
e541db2ca8
|
@ -58,14 +58,14 @@ class IBeaconMonitor {
|
|||
sendUpdate(context, sorted)
|
||||
return
|
||||
}
|
||||
assert(sorted.count() == beacons.count())
|
||||
beacons.forEachIndexed foreach@{ i, existingBeacon ->
|
||||
|
||||
if (name(sorted[i].uuid, sorted[i].major, sorted[i].minor) != name(existingBeacon.uuid, existingBeacon.major, existingBeacon.minor) || // the distance order switched
|
||||
kotlin.math.abs(sorted[i].distance - existingBeacon.distance) > 0.5 // the distance difference is greater than 0.5m
|
||||
) {
|
||||
requireUpdate = true
|
||||
return@foreach
|
||||
if (i < sorted.size) {
|
||||
if (name(sorted[i].uuid, sorted[i].major, sorted[i].minor) != name(existingBeacon.uuid, existingBeacon.major, existingBeacon.minor) || // the distance order switched
|
||||
kotlin.math.abs(sorted[i].distance - existingBeacon.distance) > 0.5 // the distance difference is greater than 0.5m
|
||||
) {
|
||||
requireUpdate = true
|
||||
return@foreach
|
||||
}
|
||||
}
|
||||
}
|
||||
if (requireUpdate) {
|
||||
|
|
Loading…
Reference in a new issue