@flomentumsolutions/capacitor-health-extended 0.3.1 → 0.4.2
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/{FlomentumSolutionsCapacitorHealthExtended.podspec → FlomentumsolutionsCapacitorHealthExtended.podspec} +1 -1
- package/Package.swift +2 -2
- package/README.md +87 -15
- package/android/src/main/java/com/flomentum/health/capacitor/HealthPlugin.kt +327 -182
- package/android/src/main/java/com/flomentum/health/capacitor/PermissionsRationaleActivity.kt +1 -1
- package/dist/esm/definitions.d.ts +3 -0
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/HealthPluginPlugin/HealthPlugin.swift +287 -69
- package/package.json +9 -4
|
@@ -3,7 +3,7 @@ require 'json'
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = '
|
|
6
|
+
s.name = 'FlomentumsolutionsCapacitorHealthExtended'
|
|
7
7
|
s.version = package['version']
|
|
8
8
|
s.summary = package['description']
|
|
9
9
|
s.license = package['license']
|
package/Package.swift
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import PackageDescription
|
|
3
3
|
|
|
4
4
|
let package = Package(
|
|
5
|
-
name: "
|
|
5
|
+
name: "FlomentumsolutionsCapacitorHealthExtended",
|
|
6
6
|
platforms: [
|
|
7
7
|
.iOS(.v15)
|
|
8
8
|
],
|
|
9
9
|
products: [
|
|
10
10
|
.library(
|
|
11
|
-
name: "
|
|
11
|
+
name: "FlomentumsolutionsCapacitorHealthExtended",
|
|
12
12
|
targets: ["HealthPluginPlugin"]
|
|
13
13
|
)
|
|
14
14
|
],
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @flomentumsolutions/capacitor-health-extended
|
|
2
2
|
|
|
3
3
|
Cross‑platform Capacitor plugin for reading data from Apple HealthKit and
|
|
4
|
-
Google Health Connect. The plugin requires **Node.js
|
|
4
|
+
Google Health Connect. The plugin requires **Node.js 22+** and is compatible
|
|
5
5
|
with **Capacitor 8**. For iOS the plugin ships a **Swift Package Manager**
|
|
6
6
|
distribution (Capacitor 8 default), while the CocoaPods spec
|
|
7
|
-
`
|
|
7
|
+
`FlomentumsolutionsCapacitorHealthExtended` remains for legacy projects.
|
|
8
8
|
|
|
9
9
|
## Thanks and attribution
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ Thanks [@mley](https://github.com/mley) for the ground work. The goal of this fo
|
|
|
19
19
|
- Node.js 22+ (Latest LTS version is recommended)
|
|
20
20
|
- Capacitor 8
|
|
21
21
|
- iOS 15+ (Xcode 26 + HealthKit + SwiftPM toolchain)
|
|
22
|
-
- Android
|
|
22
|
+
- Android 16+ (Android Studio Otter 2025.2.1 + Health Connect 1.2.0-alpha02 + Gradle 8.13.0 + Kotlin 2.2.20)
|
|
23
23
|
|
|
24
24
|
## Features
|
|
25
25
|
|
|
@@ -90,7 +90,6 @@ you can keep using the CocoaPods spec `FlomentumSolutionsCapacitorHealthExtended
|
|
|
90
90
|
<uses-permission android:name="android.permission.health.READ_SLEEP" />
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
|
|
94
93
|
* Android Manifest in application tag
|
|
95
94
|
```xml
|
|
96
95
|
<!-- Handle Health Connect rationale (Android 13-) -->
|
|
@@ -126,6 +125,69 @@ you can keep using the CocoaPods spec `FlomentumSolutionsCapacitorHealthExtended
|
|
|
126
125
|
</application>
|
|
127
126
|
```
|
|
128
127
|
|
|
128
|
+
* Create `com.my.app.PermissionsRationaleActivity.kt` with:
|
|
129
|
+
```xml
|
|
130
|
+
package com.my.app
|
|
131
|
+
|
|
132
|
+
import android.os.Bundle
|
|
133
|
+
import android.util.Log
|
|
134
|
+
import android.webkit.WebChromeClient
|
|
135
|
+
import android.webkit.WebView
|
|
136
|
+
import android.webkit.WebViewClient
|
|
137
|
+
import androidx.activity.addCallback
|
|
138
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
139
|
+
|
|
140
|
+
class PermissionsRationaleActivity : AppCompatActivity() {
|
|
141
|
+
private lateinit var webView: WebView
|
|
142
|
+
|
|
143
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
144
|
+
super.onCreate(savedInstanceState)
|
|
145
|
+
|
|
146
|
+
supportActionBar?.apply {
|
|
147
|
+
title = "Privacy Policy"
|
|
148
|
+
setDisplayHomeAsUpEnabled(true)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
webView = WebView(this).apply {
|
|
152
|
+
settings.apply {
|
|
153
|
+
javaScriptEnabled = true
|
|
154
|
+
domStorageEnabled = true
|
|
155
|
+
useWideViewPort = true
|
|
156
|
+
loadWithOverviewMode = true
|
|
157
|
+
}
|
|
158
|
+
webChromeClient = WebChromeClient()
|
|
159
|
+
webViewClient = object : WebViewClient() {
|
|
160
|
+
override fun shouldOverrideUrlLoading(view: WebView, request: android.webkit.WebResourceRequest) = false
|
|
161
|
+
override fun onReceivedError(
|
|
162
|
+
view: WebView,
|
|
163
|
+
request: android.webkit.WebResourceRequest,
|
|
164
|
+
error: android.webkit.WebResourceError
|
|
165
|
+
) {
|
|
166
|
+
Log.e("WebView", "Failed to load: ${error.description}")
|
|
167
|
+
}
|
|
168
|
+
override fun onPageFinished(view: WebView, url: String) {
|
|
169
|
+
Log.d("WebView", "Loaded: $url")
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
loadUrl("https://mywebsite.com/privacy-policy")
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
setContentView(webView)
|
|
176
|
+
|
|
177
|
+
// Device back button behavior
|
|
178
|
+
onBackPressedDispatcher.addCallback(this) {
|
|
179
|
+
finish()
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Toolbar Up button behavior
|
|
184
|
+
override fun onSupportNavigateUp(): Boolean {
|
|
185
|
+
finish()
|
|
186
|
+
return true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
129
191
|
* Create `res/xml/network_security_config.xml` with:
|
|
130
192
|
|
|
131
193
|
```xml
|
|
@@ -271,6 +333,13 @@ Query aggregated data
|
|
|
271
333
|
|
|
272
334
|
**Returns:** <code>Promise<<a href="#queryaggregatedresponse">QueryAggregatedResponse</a>></code>
|
|
273
335
|
|
|
336
|
+
- Blood-pressure aggregates return the systolic average in `value` plus `systolic`, `diastolic`, and `unit`.
|
|
337
|
+
- On iOS `total-calories` is derived as active + basal energy (Android uses Health Connect's total calories when available).
|
|
338
|
+
- Weight/height aggregation returns the latest sample per day (no averaging).
|
|
339
|
+
- Android aggregation currently supports daily buckets; unsupported buckets will be rejected.
|
|
340
|
+
- Android `distance-cycling` aggregates distance recorded during biking exercise sessions (requires distance + workouts permissions).
|
|
341
|
+
- Daily `bucket: "day"` queries use calendar-day boundaries in the device time zone (start-of-day through the next start-of-day) instead of a trailing 24-hour window. For “today,” send `startDate` at today’s start-of-day and `endDate` at now or tomorrow’s start-of-day.
|
|
342
|
+
|
|
274
343
|
--------------------
|
|
275
344
|
|
|
276
345
|
|
|
@@ -386,21 +455,24 @@ Query latest steps sample
|
|
|
386
455
|
|
|
387
456
|
#### AggregatedSample
|
|
388
457
|
|
|
389
|
-
| Prop
|
|
390
|
-
|
|
|
391
|
-
| **`startDate`**
|
|
392
|
-
| **`endDate`**
|
|
393
|
-
| **`value`**
|
|
458
|
+
| Prop | Type |
|
|
459
|
+
| ----------------- | ------------------- |
|
|
460
|
+
| **`startDate`** | <code>string</code> |
|
|
461
|
+
| **`endDate`** | <code>string</code> |
|
|
462
|
+
| **`value`** | <code>number</code> |
|
|
463
|
+
| **`systolic`** | <code>number</code> |
|
|
464
|
+
| **`diastolic`** | <code>number</code> |
|
|
465
|
+
| **`unit`** | <code>string</code> |
|
|
394
466
|
|
|
395
467
|
|
|
396
468
|
#### QueryAggregatedRequest
|
|
397
469
|
|
|
398
|
-
| Prop | Type
|
|
399
|
-
| --------------- |
|
|
400
|
-
| **`startDate`** | <code>string</code>
|
|
401
|
-
| **`endDate`** | <code>string</code>
|
|
402
|
-
| **`dataType`** | <code>'steps' \| 'active-calories' \| 'mindfulness' \| 'hrv' \| 'blood-pressure'</code> |
|
|
403
|
-
| **`bucket`** | <code>string</code>
|
|
470
|
+
| Prop | Type |
|
|
471
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
472
|
+
| **`startDate`** | <code>string</code> |
|
|
473
|
+
| **`endDate`** | <code>string</code> |
|
|
474
|
+
| **`dataType`** | <code>'steps' \| 'active-calories' \| 'total-calories' \| 'basal-calories' \| 'distance' \| 'distance-cycling' \| 'weight' \| 'height' \| 'heart-rate' \| 'resting-heart-rate' \| 'respiratory-rate' \| 'oxygen-saturation' \| 'blood-glucose' \| 'body-temperature' \| 'basal-body-temperature' \| 'body-fat' \| 'flights-climbed' \| 'exercise-time' \| 'sleep' \| 'mindfulness' \| 'hrv' \| 'blood-pressure'</code> |
|
|
475
|
+
| **`bucket`** | <code>string</code> |
|
|
404
476
|
|
|
405
477
|
|
|
406
478
|
#### QueryWorkoutResponse
|