@solutionforest/android-health-connect 0.0.0-stage → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/AndroidHealthConnect.podspec +20 -0
  2. package/CHANGELOG.md +211 -0
  3. package/LICENSE +20 -0
  4. package/README.md +849 -2
  5. package/SECURITY.md +99 -0
  6. package/android/build.gradle +104 -0
  7. package/android/src/main/AndroidManifest.xml +4 -0
  8. package/android/src/main/java/com/androidhealthconnect/AggregateMapper.kt +521 -0
  9. package/android/src/main/java/com/androidhealthconnect/AndroidHealthConnectModule.kt +637 -0
  10. package/android/src/main/java/com/androidhealthconnect/AndroidHealthConnectPackage.kt +31 -0
  11. package/android/src/main/java/com/androidhealthconnect/AvailabilitySupport.kt +149 -0
  12. package/android/src/main/java/com/androidhealthconnect/ChangesMapper.kt +105 -0
  13. package/android/src/main/java/com/androidhealthconnect/ExtendedRecordMapper.kt +665 -0
  14. package/android/src/main/java/com/androidhealthconnect/FeatureSupport.kt +88 -0
  15. package/android/src/main/java/com/androidhealthconnect/PhrMapper.kt +187 -0
  16. package/android/src/main/java/com/androidhealthconnect/PlannedExerciseMapper.kt +242 -0
  17. package/android/src/main/java/com/androidhealthconnect/RecordMapper.kt +1222 -0
  18. package/app.plugin.js +1 -0
  19. package/docs/assets/logo.jpg +0 -0
  20. package/ios/AndroidHealthConnect.h +5 -0
  21. package/ios/AndroidHealthConnect.mm +21 -0
  22. package/lib/module/NativeAndroidHealthConnect.js +5 -0
  23. package/lib/module/NativeAndroidHealthConnect.js.map +1 -0
  24. package/lib/module/foreground.js +117 -0
  25. package/lib/module/foreground.js.map +1 -0
  26. package/lib/module/helpers.js +280 -0
  27. package/lib/module/helpers.js.map +1 -0
  28. package/lib/module/index.js +354 -0
  29. package/lib/module/index.js.map +1 -0
  30. package/lib/module/package.json +1 -0
  31. package/lib/module/types.js +392 -0
  32. package/lib/module/types.js.map +1 -0
  33. package/lib/module/upgrade.js +101 -0
  34. package/lib/module/upgrade.js.map +1 -0
  35. package/lib/typescript/package.json +1 -0
  36. package/lib/typescript/plugin/src/index.d.ts +14 -0
  37. package/lib/typescript/plugin/src/index.d.ts.map +1 -0
  38. package/lib/typescript/src/NativeAndroidHealthConnect.d.ts +95 -0
  39. package/lib/typescript/src/NativeAndroidHealthConnect.d.ts.map +1 -0
  40. package/lib/typescript/src/foreground.d.ts +43 -0
  41. package/lib/typescript/src/foreground.d.ts.map +1 -0
  42. package/lib/typescript/src/helpers.d.ts +108 -0
  43. package/lib/typescript/src/helpers.d.ts.map +1 -0
  44. package/lib/typescript/src/index.d.ts +208 -0
  45. package/lib/typescript/src/index.d.ts.map +1 -0
  46. package/lib/typescript/src/types.d.ts +1209 -0
  47. package/lib/typescript/src/types.d.ts.map +1 -0
  48. package/lib/typescript/src/upgrade.d.ts +26 -0
  49. package/lib/typescript/src/upgrade.d.ts.map +1 -0
  50. package/package.json +255 -4
  51. package/plugin/build/index.d.ts +13 -0
  52. package/plugin/build/index.js +57 -0
  53. package/plugin/src/index.ts +105 -0
  54. package/src/NativeAndroidHealthConnect.ts +133 -0
  55. package/src/foreground.ts +167 -0
  56. package/src/helpers.ts +373 -0
  57. package/src/index.tsx +623 -0
  58. package/src/types.ts +1525 -0
  59. package/src/upgrade.ts +155 -0
@@ -0,0 +1,20 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "AndroidHealthConnect"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/solutionforest/AndroidHealthConnect.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ install_modules_dependencies(s)
20
+ end
package/CHANGELOG.md ADDED
@@ -0,0 +1,211 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@solutionforest/android-health-connect` are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.3.14] - 2026-11-23
11
+
12
+ ### Changed
13
+
14
+ - Distribution: **npmjs.org is primary** (Trusted Publishing / OIDC from
15
+ `release.yml`); GitHub Packages remains a mirror. Install docs no longer
16
+ require a GitHub Packages `.npmrc`.
17
+
18
+ ## [0.3.13] - 2026-11-23
19
+
20
+ ### Added
21
+
22
+ - Full Health Connect record parity: `Nutrition`, `Vo2Max`, `Speed`, `Power`,
23
+ `StepsCadence`, `CyclingPedalingCadence`, `WheelchairPushes`,
24
+ `MenstruationFlow`, `MenstruationPeriod`, `OvulationTest`, `CervicalMucus`,
25
+ `IntermenstrualBleeding`, `SexualActivity`, `BasalBodyTemperature`,
26
+ `LeanBodyMass`, `BoneMass`, `BodyWaterMass`, `BasalMetabolicRate`, and
27
+ `HeartRateVariabilityRmssd`, including read/write/delete, changelog
28
+ serialization, typed helpers/permissions, and available aggregate metrics.
29
+ - These types are unit-tested but **not fully verified on real devices yet**.
30
+
31
+ ## [0.3.12] - 2026-11-21
32
+
33
+ ### Added
34
+
35
+ - DX helpers: `ensurePermissions`, `timeRangeToday` / `timeRangeLastDays` /
36
+ `timeRangeLastHours`, `waitForRecords` (poll — HC has no push), `readAllRecords`
37
+ (pageToken drain), `pullChanges` (changelog `hasMore` loop).
38
+ - `pollUntil` / `waitUntil` for resume UX (first aggregate often `0` until vendor
39
+ sync finishes); soft timeout keeps last value for the UI.
40
+ - `useForegroundPoll` hook and `pollOnForeground` (non-React): poll on mount and
41
+ every `AppState` resume, abort on background, drop stale results; hook exposes
42
+ `{ value, satisfied, loading, error, refresh }` and `enabled` to wait for
43
+ permissions.
44
+
45
+ ## [0.3.11] - 2026-11-21
46
+
47
+ ### Added
48
+
49
+ - `Permission` constants for typed Health Connect permission strings
50
+ (autocomplete instead of hand-typed literals).
51
+ - Quick helpers: `hasPermissions`, `missingPermissions`, `ensureAvailable`
52
+ (optional open store when `notInstalled`).
53
+ - `PlannedExerciseSession` CRUD (feature-gated): blocks / steps, completion
54
+ goals, performance targets; `Permission.READ/WRITE_PLANNED_EXERCISE`;
55
+ `readPlannedExerciseSessions`; `ExercisePhase` constants.
56
+
57
+ ### Changed
58
+
59
+ - CONTRIBUTING: document optional npmjs mirror + require `yarn test:android`.
60
+ - Example app: `Permission` constants + “Seed Demo Data (fake)” for QA
61
+ (steps / heart rate / walk — not part of the published API).
62
+
63
+ ### Fixed
64
+
65
+ - Release workflow fails when git tag `v*` does not match `package.json` version.
66
+
67
+ ## [0.3.10] - 2026-11-21
68
+
69
+ ### Added
70
+
71
+ - Example app: Health Connect permissions + rationale intent-filters / string;
72
+ recipes for `updateRecords` and background permission.
73
+ - README `updateRecords` usage snippet (`metadata.id` required).
74
+ - Kotlin tests: segments/laps, zone offsets, `requireMetadataIdForUpdate`,
75
+ `FeatureSupport` name map.
76
+
77
+ ### Fixed
78
+
79
+ - CI: cache Robolectric `android-all` jars (`~/.cache/robolectric`) and pin Maven
80
+ Central for the test fetcher (avoids flaky `MavenArtifactFetcher` HTTP failures).
81
+
82
+ ## [0.3.9] - 2026-11-20
83
+
84
+ ### Added
85
+
86
+ - Typed special permissions: `READ_HEALTH_DATA_HISTORY`, `READ_HEALTH_DATA_IN_BACKGROUND`
87
+ (with README / SECURITY guidance and feature-status gating).
88
+ - `updateRecords()` for edit/sync; metadata round-trip preserves `id` / recording method /
89
+ optional `device` on write/update.
90
+ - `getChanges(token, { pageSize })` soft page-size hint (1–5000).
91
+ - Exercise session 1.2 fields (feature-gated): `plannedExerciseSessionId`,
92
+ `rateOfPerceivedExertion` when `exerciseSessionImprovements` is available.
93
+ - `ExerciseSegmentType` constants aligned with connect-client 1.2.
94
+
95
+ ### Changed
96
+
97
+ - `jsonToMetadata` no longer always uses bare `manualEntry()` (supports `*WithId` for updates).
98
+ - Expo plugin docs: omitting `permissions` declares none (intent-filters only).
99
+ - Example app recipes: aggregates, `getChanges`, history permission, exercise route.
100
+
101
+ ### Fixed
102
+
103
+ - `ExerciseType` values now match `ExerciseSessionRecord.EXERCISE_TYPE_*` (connect-client 1.2);
104
+ segment-only ids moved to `ExerciseSegmentType`. `WHEEL_CHAIR` kept as alias of `WHEELCHAIR`.
105
+
106
+ ## [0.3.8] - 2026-11-20
107
+
108
+ ### Added
109
+
110
+ - Aggregate APIs: `aggregateRecord`, `aggregateGroupByDuration` (Instant buckets — avoids
111
+ Android 14+ UTC shift), `aggregateGroupByPeriod` (LocalDateTime calendar buckets).
112
+ - Exercise routes on `ExerciseSession`: write `{ route: Location[] }` with optional altitude /
113
+ accuracy (meters); read `{ type: DATA \| NO_DATA \| CONSENT_REQUIRED, route }` with
114
+ `LengthResult` fields; `requestExerciseRoute(recordId)` for one-time consent.
115
+ - Permissions: `READ_EXERCISE_ROUTES` / `WRITE_EXERCISE_ROUTE`.
116
+ - Changelog APIs: `getChangesToken` / `getChanges` (upsertion + deletion pages,
117
+ `hasMore`, `changesTokenExpired`; tokens valid ~30 days).
118
+ - CI `test-android` job + `yarn test:android` for Kotlin / Robolectric unit tests.
119
+ - Release workflow: SPDX SBOM on the GitHub Release + Sigstore build/SBOM
120
+ attestations for the packed `.tgz` (GitHub artifact attestations).
121
+ - Optional npmjs.org mirror on Release when repo secret `NPM_TOKEN` is set
122
+ (`npm publish --provenance`); GitHub Packages remains the primary registry.
123
+
124
+ ### Changed
125
+
126
+ - Package metadata aligned with RN library standards: richer `keywords` / description,
127
+ `sideEffects: false`, explicit `exports` for Expo `app.plugin.js` + `react-native`/`import`,
128
+ ship `LICENSE` / `CHANGELOG` / `SECURITY` / logo in the tarball.
129
+ - Added PR + feature-request templates; CONTRIBUTING quality-gate checklist;
130
+ SECURITY.md security-model section (HC permissions vs host-app duties).
131
+
132
+ ## [0.3.7] - 2026-11-20
133
+
134
+ ### Added
135
+
136
+ - `getHealthConnectAvailability()` — detailed status (`sdkStatus`, `provider` framework/apk,
137
+ GMS / Play Store flags, advice) for Android 14+ built-in vs APK install and China / HMS cases.
138
+ - Safer `openHealthConnectApp()` using official `market://` Play Store intent with HTTPS
139
+ fallback; Settings fallback when Play Store is missing on Android 14+.
140
+
141
+ ### Fixed
142
+
143
+ - Clearer `HEALTH_CONNECT_UNAVAILABLE` reject messages (install vs no GMS / China vs unsupported).
144
+ - Document that raw `sdkStatus === 3` is `SDK_AVAILABLE` (common misread as “version too old”).
145
+
146
+ ## [0.3.6] - 2026-11-20
147
+
148
+ ### Changed
149
+
150
+ - Raised static analysis to PHPStan level-10 equivalent for TypeScript:
151
+ max-strict `tsconfig`, type-aware ESLint (`no-explicit-any`, `no-unsafe-*`,
152
+ floating promises, exhaustiveness), and Jest coverage gates
153
+ (statements/lines/functions ≥95%, branches ≥75%).
154
+ - Kotlin `allWarningsAsErrors`; safer unit-test assertions (no `!!`).
155
+ - CI fails when coverage thresholds drop.
156
+
157
+ ### Fixed
158
+
159
+ - `checkLibraryUpdate` treats an explicit non-function `fetchImpl` as
160
+ missing fetch (no longer swallowed by `??`).
161
+
162
+ ### Added
163
+
164
+ - Broader API unit tests (permissions revoke, data-management navigation,
165
+ PHR helpers, default options branches).
166
+
167
+ ## [0.3.5] - 2026-11-20
168
+
169
+ ### Fixed
170
+
171
+ - Skip applying `kotlin-android` when AGP 9+ already registered the `kotlin` extension (built-in Kotlin). Unconditional apply failed consumer builds with `Cannot add extension with name 'kotlin'`. See [Migrate to built-in Kotlin](https://developer.android.com/build/migrate-to-built-in-kotlin). AGP 8 / `android.builtInKotlin=false` hosts still get the legacy plugin.
172
+
173
+ ### Added
174
+
175
+ - Contract tests for the AGP 9 Kotlin plugin guard (`src/__tests__/androidAgpKotlinPlugin.test.ts`).
176
+
177
+ ### Changed
178
+
179
+ - Weekly version-check Action prefers Maven `<latest>` (includes alphas), adds Actions job summary, and documents daily / weekly / bi-weekly cron options.
180
+
181
+ ## [0.3.4] - 2026-11-18
182
+
183
+ ### Added
184
+
185
+ - Alpha Health Connect API wrappers: mindfulness, skin temperature, activity intensity, matchmaking, and Personal Health Record (PHR) helpers.
186
+
187
+ ## [0.3.3] - 2026-11-18
188
+
189
+ ### Changed
190
+
191
+ - Packaging / CI alignment for the 0.3.x (AGP 9 / compileSdk 37) line.
192
+
193
+ ## [0.2.4] - 2026-11-18
194
+
195
+ ### Changed
196
+
197
+ - Stable 0.2.x line (HC `1.1.0`, AGP 8.9 / sdk 36): GitHub Packages + hosted CI parity and security dependency fixes.
198
+
199
+ [0.3.14]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.14
200
+ [0.3.13]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.13
201
+ [0.3.12]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.12
202
+ [0.3.11]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.11
203
+ [0.3.10]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.10
204
+ [0.3.9]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.9
205
+ [0.3.8]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.8
206
+ [0.3.7]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.7
207
+ [0.3.6]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.6
208
+ [0.3.5]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.5
209
+ [0.3.4]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.4
210
+ [0.3.3]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.3
211
+ [0.2.4]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.2.4
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jayden Chan
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.