@@ -375,9 +375,39 @@ public void getBloodPressureSamples(double startDate,
375
375
String bucketUnit ,
376
376
Promise promise ) {
377
377
try {
378
- HeartrateHistory heartrateHistory = mGoogleFitManager .getHeartrateHistory ();
379
- heartrateHistory .setDataType (HealthDataTypes .TYPE_BLOOD_PRESSURE );
380
- promise .resolve (heartrateHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
378
+ HealthHistory healthHistory = mGoogleFitManager .getHealthHistory ();
379
+ healthHistory .setDataType (HealthDataTypes .TYPE_BLOOD_PRESSURE );
380
+ promise .resolve (healthHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
381
+ } catch (IllegalViewOperationException e ) {
382
+ promise .reject (e );
383
+ }
384
+ }
385
+
386
+ @ ReactMethod
387
+ public void getBodyTemperatureSamples (double startDate ,
388
+ double endDate ,
389
+ int bucketInterval ,
390
+ String bucketUnit ,
391
+ Promise promise ) {
392
+ try {
393
+ HealthHistory healthHistory = mGoogleFitManager .getHealthHistory ();
394
+ healthHistory .setDataType (HealthDataTypes .TYPE_BODY_TEMPERATURE );
395
+ promise .resolve (healthHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
396
+ } catch (IllegalViewOperationException e ) {
397
+ promise .reject (e );
398
+ }
399
+ }
400
+
401
+ @ ReactMethod
402
+ public void getOxygenSaturationSamples (double startDate ,
403
+ double endDate ,
404
+ int bucketInterval ,
405
+ String bucketUnit ,
406
+ Promise promise ) {
407
+ try {
408
+ HealthHistory healthHistory = mGoogleFitManager .getHealthHistory ();
409
+ healthHistory .setDataType (HealthDataTypes .TYPE_OXYGEN_SATURATION );
410
+ promise .resolve (healthHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
381
411
} catch (IllegalViewOperationException e ) {
382
412
promise .reject (e );
383
413
}
@@ -390,9 +420,9 @@ public void getBloodGlucoseSamples(double startDate,
390
420
String bucketUnit ,
391
421
Promise promise ) {
392
422
try {
393
- HeartrateHistory heartrateHistory = mGoogleFitManager .getHeartrateHistory ();
394
- heartrateHistory .setDataType (HealthDataTypes .TYPE_BLOOD_GLUCOSE );
395
- promise .resolve (heartrateHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
423
+ HealthHistory healthHistory = mGoogleFitManager .getHealthHistory ();
424
+ healthHistory .setDataType (HealthDataTypes .TYPE_BLOOD_GLUCOSE );
425
+ promise .resolve (healthHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
396
426
} catch (IllegalViewOperationException e ) {
397
427
promise .reject (e );
398
428
}
@@ -401,9 +431,9 @@ public void getBloodGlucoseSamples(double startDate,
401
431
@ ReactMethod
402
432
public void saveBloodGlucose (ReadableMap bloodGlucoseSample , Promise promise ) {
403
433
try {
404
- HeartrateHistory heartrateHistory = mGoogleFitManager .getHeartrateHistory ();
405
- heartrateHistory .setDataType (HealthDataTypes .TYPE_BLOOD_GLUCOSE );
406
- heartrateHistory .saveBloodGlucose (bloodGlucoseSample );
434
+ HealthHistory healthHistory = mGoogleFitManager .getHealthHistory ();
435
+ healthHistory .setDataType (HealthDataTypes .TYPE_BLOOD_GLUCOSE );
436
+ healthHistory .saveBloodGlucose (bloodGlucoseSample );
407
437
} catch (Error e ) {
408
438
promise .reject (e );
409
439
}
@@ -417,9 +447,9 @@ public void getHeartRateSamples(double startDate,
417
447
Promise promise ) {
418
448
419
449
try {
420
- HeartrateHistory heartrateHistory = mGoogleFitManager .getHeartrateHistory ();
421
- heartrateHistory .setDataType (DataType .TYPE_HEART_RATE_BPM );
422
- promise .resolve (heartrateHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
450
+ HealthHistory healthHistory = mGoogleFitManager .getHealthHistory ();
451
+ healthHistory .setDataType (DataType .TYPE_HEART_RATE_BPM );
452
+ promise .resolve (healthHistory .getHistory ((long )startDate , (long )endDate , bucketInterval , bucketUnit ));
423
453
} catch (IllegalViewOperationException e ) {
424
454
promise .reject (e );
425
455
}
0 commit comments