Skip to content

Commit

Permalink
Fix #28043, crash caused by unnecessary permissions check (#28045)
Browse files Browse the repository at this point in the history
  • Loading branch information
cltnschlosser committed Apr 5, 2024
1 parent 33ad580 commit a07d1b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 2 additions & 0 deletions packages/expo-sensors/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Prevent unnecessary permissions check when moving app to background (Would crash with certain configs). ([#28045](https://github.com/expo/expo/pull/28045) by [@cltnschlosser](https://github.com/cltnschlosser))

### 💡 Others

- drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
Expand Down
15 changes: 7 additions & 8 deletions packages/expo-sensors/ios/PedometerModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,15 @@ public final class PedometerModule: Module {
}

private func stopUpdates() {
guard let permissions = appContext?.permissions else {
guard watchHandler != nil,
let permissions = appContext?.permissions,
permissions.hasGrantedPermission(usingRequesterClass: EXMotionPermissionRequester.self) else {
return
}
if permissions.hasGrantedPermission(usingRequesterClass: EXMotionPermissionRequester.self) {
if watchHandler != nil {
pedometer.stopUpdates()
watchStartDate = nil
watchHandler = nil
}
}

pedometer.stopUpdates()
watchStartDate = nil
watchHandler = nil
}
}

Expand Down

0 comments on commit a07d1b9

Please sign in to comment.