@solutionforest/android-health-connect 0.0.0-stage → 0.3.13
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.
- package/AndroidHealthConnect.podspec +20 -0
- package/CHANGELOG.md +202 -0
- package/LICENSE +20 -0
- package/README.md +847 -2
- package/SECURITY.md +99 -0
- package/android/build.gradle +104 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/androidhealthconnect/AggregateMapper.kt +521 -0
- package/android/src/main/java/com/androidhealthconnect/AndroidHealthConnectModule.kt +637 -0
- package/android/src/main/java/com/androidhealthconnect/AndroidHealthConnectPackage.kt +31 -0
- package/android/src/main/java/com/androidhealthconnect/AvailabilitySupport.kt +149 -0
- package/android/src/main/java/com/androidhealthconnect/ChangesMapper.kt +105 -0
- package/android/src/main/java/com/androidhealthconnect/ExtendedRecordMapper.kt +665 -0
- package/android/src/main/java/com/androidhealthconnect/FeatureSupport.kt +88 -0
- package/android/src/main/java/com/androidhealthconnect/PhrMapper.kt +187 -0
- package/android/src/main/java/com/androidhealthconnect/PlannedExerciseMapper.kt +242 -0
- package/android/src/main/java/com/androidhealthconnect/RecordMapper.kt +1222 -0
- package/app.plugin.js +1 -0
- package/docs/assets/logo.jpg +0 -0
- package/ios/AndroidHealthConnect.h +5 -0
- package/ios/AndroidHealthConnect.mm +21 -0
- package/lib/module/NativeAndroidHealthConnect.js +5 -0
- package/lib/module/NativeAndroidHealthConnect.js.map +1 -0
- package/lib/module/foreground.js +117 -0
- package/lib/module/foreground.js.map +1 -0
- package/lib/module/helpers.js +280 -0
- package/lib/module/helpers.js.map +1 -0
- package/lib/module/index.js +354 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +392 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/upgrade.js +101 -0
- package/lib/module/upgrade.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/plugin/src/index.d.ts +14 -0
- package/lib/typescript/plugin/src/index.d.ts.map +1 -0
- package/lib/typescript/src/NativeAndroidHealthConnect.d.ts +95 -0
- package/lib/typescript/src/NativeAndroidHealthConnect.d.ts.map +1 -0
- package/lib/typescript/src/foreground.d.ts +43 -0
- package/lib/typescript/src/foreground.d.ts.map +1 -0
- package/lib/typescript/src/helpers.d.ts +108 -0
- package/lib/typescript/src/helpers.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +208 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +1209 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/upgrade.d.ts +26 -0
- package/lib/typescript/src/upgrade.d.ts.map +1 -0
- package/package.json +255 -4
- package/plugin/build/index.d.ts +13 -0
- package/plugin/build/index.js +57 -0
- package/plugin/src/index.ts +105 -0
- package/src/NativeAndroidHealthConnect.ts +133 -0
- package/src/foreground.ts +167 -0
- package/src/helpers.ts +373 -0
- package/src/index.tsx +623 -0
- package/src/types.ts +1525 -0
- 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,202 @@
|
|
|
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.13] - 2026-11-23
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Full Health Connect record parity: `Nutrition`, `Vo2Max`, `Speed`, `Power`,
|
|
15
|
+
`StepsCadence`, `CyclingPedalingCadence`, `WheelchairPushes`,
|
|
16
|
+
`MenstruationFlow`, `MenstruationPeriod`, `OvulationTest`, `CervicalMucus`,
|
|
17
|
+
`IntermenstrualBleeding`, `SexualActivity`, `BasalBodyTemperature`,
|
|
18
|
+
`LeanBodyMass`, `BoneMass`, `BodyWaterMass`, `BasalMetabolicRate`, and
|
|
19
|
+
`HeartRateVariabilityRmssd`, including read/write/delete, changelog
|
|
20
|
+
serialization, typed helpers/permissions, and available aggregate metrics.
|
|
21
|
+
- These types are unit-tested but **not fully verified on real devices yet**.
|
|
22
|
+
|
|
23
|
+
## [0.3.12] - 2026-11-21
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- DX helpers: `ensurePermissions`, `timeRangeToday` / `timeRangeLastDays` /
|
|
28
|
+
`timeRangeLastHours`, `waitForRecords` (poll — HC has no push), `readAllRecords`
|
|
29
|
+
(pageToken drain), `pullChanges` (changelog `hasMore` loop).
|
|
30
|
+
- `pollUntil` / `waitUntil` for resume UX (first aggregate often `0` until vendor
|
|
31
|
+
sync finishes); soft timeout keeps last value for the UI.
|
|
32
|
+
- `useForegroundPoll` hook and `pollOnForeground` (non-React): poll on mount and
|
|
33
|
+
every `AppState` resume, abort on background, drop stale results; hook exposes
|
|
34
|
+
`{ value, satisfied, loading, error, refresh }` and `enabled` to wait for
|
|
35
|
+
permissions.
|
|
36
|
+
|
|
37
|
+
## [0.3.11] - 2026-11-21
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- `Permission` constants for typed Health Connect permission strings
|
|
42
|
+
(autocomplete instead of hand-typed literals).
|
|
43
|
+
- Quick helpers: `hasPermissions`, `missingPermissions`, `ensureAvailable`
|
|
44
|
+
(optional open store when `notInstalled`).
|
|
45
|
+
- `PlannedExerciseSession` CRUD (feature-gated): blocks / steps, completion
|
|
46
|
+
goals, performance targets; `Permission.READ/WRITE_PLANNED_EXERCISE`;
|
|
47
|
+
`readPlannedExerciseSessions`; `ExercisePhase` constants.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- CONTRIBUTING: document optional npmjs mirror + require `yarn test:android`.
|
|
52
|
+
- Example app: `Permission` constants + “Seed Demo Data (fake)” for QA
|
|
53
|
+
(steps / heart rate / walk — not part of the published API).
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- Release workflow fails when git tag `v*` does not match `package.json` version.
|
|
58
|
+
|
|
59
|
+
## [0.3.10] - 2026-11-21
|
|
60
|
+
|
|
61
|
+
### Added
|
|
62
|
+
|
|
63
|
+
- Example app: Health Connect permissions + rationale intent-filters / string;
|
|
64
|
+
recipes for `updateRecords` and background permission.
|
|
65
|
+
- README `updateRecords` usage snippet (`metadata.id` required).
|
|
66
|
+
- Kotlin tests: segments/laps, zone offsets, `requireMetadataIdForUpdate`,
|
|
67
|
+
`FeatureSupport` name map.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- CI: cache Robolectric `android-all` jars (`~/.cache/robolectric`) and pin Maven
|
|
72
|
+
Central for the test fetcher (avoids flaky `MavenArtifactFetcher` HTTP failures).
|
|
73
|
+
|
|
74
|
+
## [0.3.9] - 2026-11-20
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- Typed special permissions: `READ_HEALTH_DATA_HISTORY`, `READ_HEALTH_DATA_IN_BACKGROUND`
|
|
79
|
+
(with README / SECURITY guidance and feature-status gating).
|
|
80
|
+
- `updateRecords()` for edit/sync; metadata round-trip preserves `id` / recording method /
|
|
81
|
+
optional `device` on write/update.
|
|
82
|
+
- `getChanges(token, { pageSize })` soft page-size hint (1–5000).
|
|
83
|
+
- Exercise session 1.2 fields (feature-gated): `plannedExerciseSessionId`,
|
|
84
|
+
`rateOfPerceivedExertion` when `exerciseSessionImprovements` is available.
|
|
85
|
+
- `ExerciseSegmentType` constants aligned with connect-client 1.2.
|
|
86
|
+
|
|
87
|
+
### Changed
|
|
88
|
+
|
|
89
|
+
- `jsonToMetadata` no longer always uses bare `manualEntry()` (supports `*WithId` for updates).
|
|
90
|
+
- Expo plugin docs: omitting `permissions` declares none (intent-filters only).
|
|
91
|
+
- Example app recipes: aggregates, `getChanges`, history permission, exercise route.
|
|
92
|
+
|
|
93
|
+
### Fixed
|
|
94
|
+
|
|
95
|
+
- `ExerciseType` values now match `ExerciseSessionRecord.EXERCISE_TYPE_*` (connect-client 1.2);
|
|
96
|
+
segment-only ids moved to `ExerciseSegmentType`. `WHEEL_CHAIR` kept as alias of `WHEELCHAIR`.
|
|
97
|
+
|
|
98
|
+
## [0.3.8] - 2026-11-20
|
|
99
|
+
|
|
100
|
+
### Added
|
|
101
|
+
|
|
102
|
+
- Aggregate APIs: `aggregateRecord`, `aggregateGroupByDuration` (Instant buckets — avoids
|
|
103
|
+
Android 14+ UTC shift), `aggregateGroupByPeriod` (LocalDateTime calendar buckets).
|
|
104
|
+
- Exercise routes on `ExerciseSession`: write `{ route: Location[] }` with optional altitude /
|
|
105
|
+
accuracy (meters); read `{ type: DATA \| NO_DATA \| CONSENT_REQUIRED, route }` with
|
|
106
|
+
`LengthResult` fields; `requestExerciseRoute(recordId)` for one-time consent.
|
|
107
|
+
- Permissions: `READ_EXERCISE_ROUTES` / `WRITE_EXERCISE_ROUTE`.
|
|
108
|
+
- Changelog APIs: `getChangesToken` / `getChanges` (upsertion + deletion pages,
|
|
109
|
+
`hasMore`, `changesTokenExpired`; tokens valid ~30 days).
|
|
110
|
+
- CI `test-android` job + `yarn test:android` for Kotlin / Robolectric unit tests.
|
|
111
|
+
- Release workflow: SPDX SBOM on the GitHub Release + Sigstore build/SBOM
|
|
112
|
+
attestations for the packed `.tgz` (GitHub artifact attestations).
|
|
113
|
+
- Optional npmjs.org mirror on Release when repo secret `NPM_TOKEN` is set
|
|
114
|
+
(`npm publish --provenance`); GitHub Packages remains the primary registry.
|
|
115
|
+
|
|
116
|
+
### Changed
|
|
117
|
+
|
|
118
|
+
- Package metadata aligned with RN library standards: richer `keywords` / description,
|
|
119
|
+
`sideEffects: false`, explicit `exports` for Expo `app.plugin.js` + `react-native`/`import`,
|
|
120
|
+
ship `LICENSE` / `CHANGELOG` / `SECURITY` / logo in the tarball.
|
|
121
|
+
- Added PR + feature-request templates; CONTRIBUTING quality-gate checklist;
|
|
122
|
+
SECURITY.md security-model section (HC permissions vs host-app duties).
|
|
123
|
+
|
|
124
|
+
## [0.3.7] - 2026-11-20
|
|
125
|
+
|
|
126
|
+
### Added
|
|
127
|
+
|
|
128
|
+
- `getHealthConnectAvailability()` — detailed status (`sdkStatus`, `provider` framework/apk,
|
|
129
|
+
GMS / Play Store flags, advice) for Android 14+ built-in vs APK install and China / HMS cases.
|
|
130
|
+
- Safer `openHealthConnectApp()` using official `market://` Play Store intent with HTTPS
|
|
131
|
+
fallback; Settings fallback when Play Store is missing on Android 14+.
|
|
132
|
+
|
|
133
|
+
### Fixed
|
|
134
|
+
|
|
135
|
+
- Clearer `HEALTH_CONNECT_UNAVAILABLE` reject messages (install vs no GMS / China vs unsupported).
|
|
136
|
+
- Document that raw `sdkStatus === 3` is `SDK_AVAILABLE` (common misread as “version too old”).
|
|
137
|
+
|
|
138
|
+
## [0.3.6] - 2026-11-20
|
|
139
|
+
|
|
140
|
+
### Changed
|
|
141
|
+
|
|
142
|
+
- Raised static analysis to PHPStan level-10 equivalent for TypeScript:
|
|
143
|
+
max-strict `tsconfig`, type-aware ESLint (`no-explicit-any`, `no-unsafe-*`,
|
|
144
|
+
floating promises, exhaustiveness), and Jest coverage gates
|
|
145
|
+
(statements/lines/functions ≥95%, branches ≥75%).
|
|
146
|
+
- Kotlin `allWarningsAsErrors`; safer unit-test assertions (no `!!`).
|
|
147
|
+
- CI fails when coverage thresholds drop.
|
|
148
|
+
|
|
149
|
+
### Fixed
|
|
150
|
+
|
|
151
|
+
- `checkLibraryUpdate` treats an explicit non-function `fetchImpl` as
|
|
152
|
+
missing fetch (no longer swallowed by `??`).
|
|
153
|
+
|
|
154
|
+
### Added
|
|
155
|
+
|
|
156
|
+
- Broader API unit tests (permissions revoke, data-management navigation,
|
|
157
|
+
PHR helpers, default options branches).
|
|
158
|
+
|
|
159
|
+
## [0.3.5] - 2026-11-20
|
|
160
|
+
|
|
161
|
+
### Fixed
|
|
162
|
+
|
|
163
|
+
- 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.
|
|
164
|
+
|
|
165
|
+
### Added
|
|
166
|
+
|
|
167
|
+
- Contract tests for the AGP 9 Kotlin plugin guard (`src/__tests__/androidAgpKotlinPlugin.test.ts`).
|
|
168
|
+
|
|
169
|
+
### Changed
|
|
170
|
+
|
|
171
|
+
- Weekly version-check Action prefers Maven `<latest>` (includes alphas), adds Actions job summary, and documents daily / weekly / bi-weekly cron options.
|
|
172
|
+
|
|
173
|
+
## [0.3.4] - 2026-11-18
|
|
174
|
+
|
|
175
|
+
### Added
|
|
176
|
+
|
|
177
|
+
- Alpha Health Connect API wrappers: mindfulness, skin temperature, activity intensity, matchmaking, and Personal Health Record (PHR) helpers.
|
|
178
|
+
|
|
179
|
+
## [0.3.3] - 2026-11-18
|
|
180
|
+
|
|
181
|
+
### Changed
|
|
182
|
+
|
|
183
|
+
- Packaging / CI alignment for the 0.3.x (AGP 9 / compileSdk 37) line.
|
|
184
|
+
|
|
185
|
+
## [0.2.4] - 2026-11-18
|
|
186
|
+
|
|
187
|
+
### Changed
|
|
188
|
+
|
|
189
|
+
- Stable 0.2.x line (HC `1.1.0`, AGP 8.9 / sdk 36): GitHub Packages + hosted CI parity and security dependency fixes.
|
|
190
|
+
|
|
191
|
+
[0.3.13]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.13
|
|
192
|
+
[0.3.12]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.12
|
|
193
|
+
[0.3.11]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.11
|
|
194
|
+
[0.3.10]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.10
|
|
195
|
+
[0.3.9]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.9
|
|
196
|
+
[0.3.8]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.8
|
|
197
|
+
[0.3.7]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.7
|
|
198
|
+
[0.3.6]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.6
|
|
199
|
+
[0.3.5]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.5
|
|
200
|
+
[0.3.4]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.4
|
|
201
|
+
[0.3.3]: https://github.com/solutionforest/AndroidHealthConnect/releases/tag/v0.3.3
|
|
202
|
+
[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.
|