@flomentumsolutions/capacitor-health-extended 0.0.16 → 0.0.17
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.
|
@@ -144,13 +144,19 @@ class HealthPlugin : Plugin() {
|
|
|
144
144
|
call.resolve(result)
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
// Helper to ensure
|
|
147
|
+
// Helper to ensure HealthConnectClient is ready; attempts init lazily
|
|
148
148
|
private fun ensureClientInitialized(call: PluginCall): Boolean {
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
if (available) return true
|
|
150
|
+
|
|
151
|
+
return try {
|
|
152
|
+
healthConnectClient = HealthConnectClient.getOrCreate(context)
|
|
153
|
+
available = true
|
|
154
|
+
true
|
|
155
|
+
} catch (e: Exception) {
|
|
156
|
+
Log.e(tag, "Failed to initialise HealthConnectClient", e)
|
|
157
|
+
call.reject("Health Connect is not available on this device.")
|
|
158
|
+
false
|
|
152
159
|
}
|
|
153
|
-
return true
|
|
154
160
|
}
|
|
155
161
|
|
|
156
162
|
// Check if a set of permissions are granted
|
package/package.json
CHANGED