Manage unnecessary permission data for android #1263
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 capturing the raw workout activity type in the Dart data model. The main changes are grouped into Android permission checks and Dart model enhancements.
Android permission checks:
HealthPermissionChecker
class to encapsulate permission checks for location, distance, calories burned, and steps inHealthPermissionChecker.kt
.HealthDataReader.kt
to useHealthPermissionChecker
before attempting to read workout distance, calories burned, and steps; if permissions are missing, the retrieval is skipped and a log message is recorded. [1] [2] [3] [4] [5]HealthDataReader.kt
to return a proper error result when data is unavailable, instead of returningnull
.Dart model enhancements:
rawWorkoutActivityType
field to theWorkoutHealthValue
class inhealth_value_types.dart
, storing the raw activity type from native data. Updated the constructor, factory,toString
, equality, and hashCode methods to support this new field. [1] [2] [3] [4]