feat: add setIgnoredSources for Apple Health source filtering#16
feat: add setIgnoredSources for Apple Health source filtering#16terra-alex wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature to the Terra Flutter bridge, enabling the filtering of Apple Health data sources by specifying bundle identifiers to be ignored. This functionality is fully implemented for iOS, integrating with the native TerraiOS SDK, while providing a compatible no-op implementation for Android to maintain cross-platform consistency. Additionally, several older methods have been marked for deprecation. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces the setIgnoredSources feature as described. The implementation looks good across Dart, iOS, and Android. I've made a couple of suggestions for improvement regarding code conciseness on Android and API consistency in the Dart layer. Additionally, this PR includes several deprecation annotations for other methods. While this is fine, it's generally better to keep pull requests focused on a single concern to make them easier to review and track.
| HashMap<String, Object> ignoredResult = new HashMap<>(); | ||
| ignoredResult.put("success", true); | ||
| result.success(ignoredResult); |
There was a problem hiding this comment.
For creating a simple, immutable map with a single entry, it's more concise and efficient to use java.util.Collections.singletonMap().
| HashMap<String, Object> ignoredResult = new HashMap<>(); | |
| ignoredResult.put("success", true); | |
| result.success(ignoredResult); | |
| result.success(java.util.Collections.singletonMap("success", true)); |
| static Future<void> setIgnoredSources(List<String> sources) async { | ||
| await _channel.invokeMethod('setIgnoredSources', { | ||
| "sources": sources | ||
| }); | ||
| } |
There was a problem hiding this comment.
For consistency with other methods in this class (like initTerra and initConnection), this method should return a Future<SuccessMessage?> instead of Future<void>. This would involve parsing the response from the native side. While the native implementations currently always return success, this change would make the API more consistent and robust for any future changes where an error might be returned.
| static Future<void> setIgnoredSources(List<String> sources) async { | |
| await _channel.invokeMethod('setIgnoredSources', { | |
| "sources": sources | |
| }); | |
| } | |
| static Future<SuccessMessage?> setIgnoredSources(List<String> sources) async { | |
| return SuccessMessage.fromJson(Map<String, dynamic>.from(await _channel.invokeMethod('setIgnoredSources', { | |
| "sources": sources | |
| }))); | |
| } |
Bridges Terra.setIgnoredSources() from the iOS SDK through the Flutter method channel. Takes a list of bundle identifiers to exclude from HealthKit reads. Android side is a no-op that returns success. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4b7ca86 to
8f1fa27
Compare
Summary
TerraFlutter.setIgnoredSources(List<String>)to the Dart APITerra.setIgnoredSources()from TerraiOS SDKTest plan
setIgnoredSources(["com.whoop.app"])afterinitTerra, verify WHOOP-sourced HealthKit data is excludedsetIgnoredSources, verify it completes without error"setIgnoredSources"matches across Dart/iOS/AndroidClaude conversation: /Users/alex/Documents/terra-support-agent
🤖 Generated with Claude Code