mirror of
https://github.com/home-assistant/android
synced 2024-09-06 17:23:32 +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)
|
sendUpdate(context, sorted)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
assert(sorted.count() == beacons.count())
|
|
||||||
beacons.forEachIndexed foreach@{ i, existingBeacon ->
|
beacons.forEachIndexed foreach@{ i, existingBeacon ->
|
||||||
|
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
|
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
|
kotlin.math.abs(sorted[i].distance - existingBeacon.distance) > 0.5 // the distance difference is greater than 0.5m
|
||||||
) {
|
) {
|
||||||
requireUpdate = true
|
requireUpdate = true
|
||||||
return@foreach
|
return@foreach
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (requireUpdate) {
|
if (requireUpdate) {
|
||||||
|
|
Loading…
Reference in a new issue