@flomentumsolutions/capacitor-health-extended 0.0.12 → 0.0.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.
@@ -237,23 +237,26 @@ public class HealthPlugin: CAPPlugin, CAPBridgedPlugin {
237
237
 
238
238
  // Convenience methods for specific data types
239
239
  @objc func queryWeight(_ call: CAPPluginCall) {
240
- call.setString("dataType", "weight")
241
- queryLatestSample(call)
240
+ queryLatestSampleWithType(call, dataType: "weight")
242
241
  }
243
242
 
244
243
  @objc func queryHeight(_ call: CAPPluginCall) {
245
- call.setString("dataType", "height")
246
- queryLatestSample(call)
244
+ queryLatestSampleWithType(call, dataType: "height")
247
245
  }
248
246
 
249
247
  @objc func queryHeartRate(_ call: CAPPluginCall) {
250
- call.setString("dataType", "heart-rate")
251
- queryLatestSample(call)
248
+ queryLatestSampleWithType(call, dataType: "heart-rate")
252
249
  }
253
250
 
254
251
  @objc func querySteps(_ call: CAPPluginCall) {
255
- call.setString("dataType", "steps")
256
- queryLatestSample(call)
252
+ queryLatestSampleWithType(call, dataType: "steps")
253
+ }
254
+
255
+ private func queryLatestSampleWithType(_ call: CAPPluginCall, dataType: String) {
256
+ let params = NSMutableDictionary(dictionary: call.options ?? [:])
257
+ params["dataType"] = dataType
258
+ let proxyCall = CAPPluginCall(callbackId: call.callbackId, options: params as? [String: Any], success: call.success, error: call.error)
259
+ queryLatestSample(proxyCall)
257
260
  }
258
261
 
259
262
  @objc func openAppleHealthSettings(_ call: CAPPluginCall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flomentumsolutions/capacitor-health-extended",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Capacitor plugin for Apple HealthKit and Google Health Connect Platform",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",