Add HealthService for managing health data and caching mechanisms#79
Merged
Add HealthService for managing health data and caching mechanisms#79
Conversation
- Replace current local_health_impl.dart with a new caching approach - Add healthService, that either requests flutter health data from local_health or returns the cached data
ScreepCode
approved these changes
Apr 6, 2025
Owner
ScreepCode
left a comment
There was a problem hiding this comment.
Seems very good and useful :)
Note: We should implement an clearCache to the debug settings, mentioned in #81
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 includes significant changes to the health data handling and device information retrieval in the repository. The most important changes involve refactoring the
BaseLocalHealthImplclass, updating theDeviceInfoRepositoryImplclass, and modifying theStreakRepositoryImplclass to use a new health service.Refactoring and improvements to health data handling:
lib/data/repositories/base_local_health_impl.dart: Introduced theBaseLocalHealthRepoImplclass with improved methods for fetching health data, handling overlaps, and writing tracking data to health. This includes methods likegetHealthDataInInterval,getDistanceOfWorkoutsInInterval, andwriteTrackingToHealth.lib/data/repositories/local_health_impl.dart: Removed the oldLocalHealthRepoImplclass and its methods, which have been replaced by the newBaseLocalHealthRepoImplclass.Updates to device information retrieval:
lib/data/repositories/device_info_repository_impl.dart: Changed the logic for setting the installation date and getting the last opened date to use the current date instead of a date 30 days ago. [1] [2]Modifications to streak repository:
lib/data/repositories/streak_repository_impl.dart: Replaced theLocalHealthRepositorydependency withHealthServiceImpland updated the logic to use this new service for fetching steps and other health data. [1] [2] [3] [4] [5]