react-native-health-connect 3.3.0 → 3.3.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.
@@ -255,12 +255,16 @@ class HealthConnectManager(private val applicationContext: ReactApplicationConte
255
255
  coroutineScope.launch {
256
256
  val record = reactRecordTypeToClassMap[recordType]
257
257
  if (record != null) {
258
- healthConnectClient.deleteRecords(
259
- recordType = record,
260
- recordIdsList = recordIdsList.toArrayList().mapNotNull { it.toString() }.toList(),
261
- clientRecordIdsList = if (clientRecordIdsList.size() > 0) clientRecordIdsList.toArrayList()
262
- .mapNotNull { it.toString() }.toList() else emptyList()
263
- )
258
+ try {
259
+ healthConnectClient.deleteRecords(
260
+ recordType = record,
261
+ recordIdsList = recordIdsList.toArrayList().mapNotNull { it.toString() }.toList(),
262
+ clientRecordIdsList = clientRecordIdsList.toArrayList().mapNotNull { it.toString() }.toList()
263
+ )
264
+ promise.resolve(true)
265
+ } catch (e: Exception) {
266
+ promise.rejectWithException(e)
267
+ }
264
268
  }
265
269
  }
266
270
  }
@@ -273,9 +277,14 @@ class HealthConnectManager(private val applicationContext: ReactApplicationConte
273
277
  coroutineScope.launch {
274
278
  val record = reactRecordTypeToClassMap[recordType]
275
279
  if (record != null) {
276
- healthConnectClient.deleteRecords(
277
- recordType = record, timeRangeFilter = timeRangeFilter.getTimeRangeFilter()
278
- )
280
+ try {
281
+ healthConnectClient.deleteRecords(
282
+ recordType = record, timeRangeFilter = timeRangeFilter.getTimeRangeFilter()
283
+ )
284
+ promise.resolve(true)
285
+ } catch (e: Exception) {
286
+ promise.rejectWithException(e)
287
+ }
279
288
  }
280
289
  }
281
290
  }
@@ -24,7 +24,7 @@ class ReactVo2MaxRecord : ReactHealthRecordImpl<Vo2MaxRecord> {
24
24
  Vo2MaxRecord(
25
25
  time = Instant.parse(map.getString("time")),
26
26
  zoneOffset = null,
27
- vo2MillilitersPerMinuteKilogram = map.getDouble("vo2Max"),
27
+ vo2MillilitersPerMinuteKilogram = map.getDouble("vo2MillilitersPerMinuteKilogram"),
28
28
  measurementMethod = map.getSafeInt(
29
29
  "measurementMethod",
30
30
  Vo2MaxRecord.MEASUREMENT_METHOD_OTHER
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-health-connect",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "description": "React native library for health connect (Android only)",
5
5
  "funding": "https://github.com/matinzd/react-native-health-connect?sponsor=1",
6
6
  "main": "lib/commonjs/index",