Skip to content

Commit

Permalink
Fix Missing Updates for Non-Simulator Builds (#26)
Browse files Browse the repository at this point in the history
# Fix Missing Updates for Non-Simulator Builds

## ⚙️ Release Notes 
- Fix Missing Updates for Non-Simulator Builds

CC: Interesting situation here @vishnuravi & @Supereg. Our CI did not
catch this error as we only build for simulator target. Might be
interesting to explore how we could mitigate this in the future, e.g.,
also run an archive of the UITests application to run on the generic iOS
target & test release builds at the same time?


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).
  • Loading branch information
PSchmiedmayer authored May 24, 2024
1 parent d8700fb commit 76732eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/SpeziTimedWalkTest/TimedWalkTestViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ class TimedWalkTestViewModel {
func requestPedemoterAccess() {
#if !targetEnvironment(simulator)
guard CMPedometer.isStepCountingAvailable() else {
walkTestResponse = .failure(.unauthorized)
walkTestResponse = .failed(.unauthorized)
return
}

pedometer.queryPedometerData(from: .now, to: .now) { data, error in
if data != nil {
self.authorizationStatus = CMPedometer.authorizationStatus()
} else {
self.walkTestResponse = .failure(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
self.walkTestResponse = .failed(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
}
}
#else
Expand Down Expand Up @@ -81,7 +81,7 @@ class TimedWalkTestViewModel {
#if !targetEnvironment(simulator)
pedometer.queryPedometerData(from: walkTestStartDate, to: walkTestEndDate) { data, error in
if let data, let distance = data.distance?.doubleValue {
self.walkTestResponse = .success(
self.walkTestResponse = .completed(
TimedWalkTestResult(
stepCount: data.numberOfSteps.doubleValue,
distance: distance,
Expand All @@ -90,7 +90,7 @@ class TimedWalkTestViewModel {
)
)
} else {
self.walkTestResponse = .failure(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
self.walkTestResponse = .failed(TimedWalkTestError(errorCode: (error as? NSError)?.code ?? -1))
}
}
#else
Expand Down

0 comments on commit 76732eb

Please sign in to comment.