Skip to content

Commit

Permalink
update floor yoda logic
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswebb09 committed Aug 9, 2024
1 parent f293092 commit 2ac63c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import ArcGIS
import Combine
import CoreLocation
import Foundation

extension ShowDeviceLocationUsingIndoorPositioningView {
@MainActor
Expand Down Expand Up @@ -119,7 +119,8 @@ extension ShowDeviceLocationUsingIndoorPositioningView {
// it is necessary to display the same information to the user as the floor manager levelNumber
// one is added to the floor level value.
if let floorLevel = location.additionalSourceProperties[.floor] as? Int,
(floorLevel + 1) != currentFloor {
var floor = currentFloor,
floorLevel != floor - 1 {
// Sets the currentFloor to the new floor level and adds one, since location uses
// zero based flooring system.
currentFloor = floorLevel + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ struct ShowDeviceLocationUsingIndoorPositioningView: View {
if let currentFloor = model.currentFloor {
labelTextLeading += "Current floor: \(currentFloor)\n"
if let horizontalAccuracy = model.horizontalAccuracy {
let measuredAccuracy = Measurement(value: horizontalAccuracy, unit: UnitLength.meters)
labelTextLeading += "Accuracy: \(measuredAccuracy.formatted(.measurement(width: .abbreviated, usage: .asProvided, numberFormatStyle: .number.precision(.fractionLength(2)))))"
let accuracyMeasurement = Measurement(value: horizontalAccuracy, unit: UnitLength.meters)
labelTextLeading += "Accuracy: \(accuracyMeasurement.formatted(.measurement(width: .abbreviated, usage: .asProvided, numberFormatStyle: .number.precision(.fractionLength(2)))))"
}
if let sensorCount = model.sensorCount {
labelTextTrailing += "Number of sensors: \(sensorCount)\n"
Expand Down

0 comments on commit 2ac63c2

Please sign in to comment.