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.
Title: Add HealthKit Integration for Fitness and Activity Data Retrieval
Description:
This pull request introduces HealthKit support to the iOS PWA wrapper, providing capabilities for data authorization, retrieval, and JavaScript communication for fitness and activity data. The following major functionalities have been added:
Key Features and Changes:
HealthKit Setup and Authorization:
setupHealthKit
: Ensures HealthKit is available on the device.requestAuthorization
: Requests read access to specific HealthKit data types, including steps, distance, active energy, heart rate, and more.checkAuthorizationStatus
: Checks the authorization status for a specified HealthKit data type.Data Retrieval and Aggregation:
fetchHealthData
: Aggregates data for steps, distance, and energy burned over the past three days and provides workout summaries.fetchDetailedWorkouts
: Retrieves details of recent workouts, including specific metrics such as active energy, elevation, speed, heart rate data, and step count.JavaScript Communication:
handleHealthKitPermission
: Notifies the web view of authorization results (granted or denied).handleHealthKitData
: Passes retrieved HealthKit data to the web view in JSON format to enable further processing or display in the PWA.Helper Functions:
fetchActiveEnergy
,fetchElevationData
,fetchHeartRateData
,fetchRouteData
,fetchStepCount
, andfetchFlightsClimbed
: These helper methods retrieve detailed metrics for various workout activities.fetchHeartRateTimeSeries
: Gathers heart rate data over time for accurate visualization and analysis.Workout Activity Type Extension:
HKWorkoutActivityType
has been added to map activity types to user-friendly names for display purposes.Impact:
This enhancement enables PWAs to leverage HealthKit’s fitness data, making it possible to integrate rich health insights into the web-based app. Users can view their fitness metrics within the PWA interface.