Unnecessary fetch health permissions #449
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces improved permission handling for health data retrieval on Android and adds support for tracking the raw workout activity type in the Dart data model. The changes focus on ensuring that sensitive health data is only accessed when the appropriate permissions are granted, with clear logging and error handling, and on making the workout data model more robust and informative.
Android: Enhanced permission checks and error handling
HealthPermissionCheckerclass to centralize and simplify permission checks for location, distance, calories burned, and steps data. This class ensures that data is only accessed if the corresponding permissions are granted, improving security and user privacy. (android/src/main/kotlin/cachet/plugins/health/HealthPermissionChecker.kt)HealthDataReaderto useHealthPermissionCheckerfor checking permissions before retrieving distance, calories burned, and steps data. If permissions are missing, the code now logs a message and skips data retrieval for that type, instead of attempting access. (android/src/main/kotlin/cachet/plugins/health/HealthDataReader.kt) [1] [2] [3] [4]HealthDataReaderby returning a more descriptive error with an empty list when data is unavailable, instead of just an empty list. (android/src/main/kotlin/cachet/plugins/health/HealthDataReader.kt)