@tryvital/vital-core-react-native 1.8.0 → 1.9.0
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/android/build/.transforms/02e4659475ffc7a86a28c4fd2eb4e342/transformed/out/jars/classes.jar +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule$Companion.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule$cleanUp$1.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule$createConnectedSourceIfNotExist$1.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule$deregisterProvider$1.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule$postTimeSeriesData$1.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule$userConnectedSources$1.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModule.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModuleKt$moshi$2.dex +0 -0
- package/android/build/.transforms/906c6adc574efcda43ab9f7ab88d85cf/transformed/release/com/vitalcorereactnative/VitalCoreReactNativeModuleKt.dex +0 -0
- package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
- package/android/build/intermediates/aar_main_jar/release/classes.jar +0 -0
- package/android/build/intermediates/compile_library_classes_jar/release/classes.jar +0 -0
- package/android/build/intermediates/full_jar/release/full.jar +0 -0
- package/android/build/intermediates/javac/release/classes/com/vitalcorereactnative/BuildConfig.class +0 -0
- package/android/build/intermediates/local_aar_for_lint/release/out.aar +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/BuildConfig.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule$Companion.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule$cleanUp$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule$createConnectedSourceIfNotExist$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule$deregisterProvider$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule$postTimeSeriesData$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule$userConnectedSources$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModuleKt$moshi$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/release/com/vitalcorereactnative/VitalCoreReactNativeModuleKt.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/release/classes.jar +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
- package/android/build/kotlin/compileReleaseKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileReleaseKotlin/local-state/build-history.bin +0 -0
- package/android/build/kotlin/compileReleaseUnitTestKotlin/cacheable/last-build.bin +0 -0
- package/android/build/kotlin/compileReleaseUnitTestKotlin/local-state/build-history.bin +0 -0
- package/android/build/outputs/aar/tryvital_vital-core-react-native-debug.aar +0 -0
- package/android/build/outputs/aar/tryvital_vital-core-react-native-release.aar +0 -0
- package/android/build/reports/tests/testDebugUnitTest/classes/com.vitalcorereactnative.SerializationTests.html +3 -3
- package/android/build/reports/tests/testDebugUnitTest/index.html +4 -4
- package/android/build/reports/tests/testDebugUnitTest/packages/com.vitalcorereactnative.html +3 -3
- package/android/build/reports/tests/testReleaseUnitTest/classes/com.vitalcorereactnative.SerializationTests.html +4 -4
- package/android/build/reports/tests/testReleaseUnitTest/index.html +4 -4
- package/android/build/reports/tests/testReleaseUnitTest/packages/com.vitalcorereactnative.html +3 -3
- package/android/build/test-results/testDebugUnitTest/TEST-com.vitalcorereactnative.SerializationTests.xml +2 -2
- package/android/build/test-results/testDebugUnitTest/binary/results.bin +0 -0
- package/android/build/test-results/testReleaseUnitTest/TEST-com.vitalcorereactnative.SerializationTests.xml +3 -3
- package/android/build/test-results/testReleaseUnitTest/binary/results.bin +0 -0
- package/android/build/tmp/compileReleaseJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule$Companion.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule$cleanUp$1.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule$createConnectedSourceIfNotExist$1.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule$deregisterProvider$1.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule$postTimeSeriesData$1.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule$userConnectedSources$1.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModule.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModuleKt$moshi$2.class +0 -0
- package/android/build/tmp/kotlin-classes/release/com/vitalcorereactnative/VitalCoreReactNativeModuleKt.class +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/vitalcorereactnative/VitalCoreReactNativeModule.kt +27 -14
- package/package.json +1 -1
package/android/build/.transforms/02e4659475ffc7a86a28c4fd2eb4e342/transformed/out/jars/classes.jar
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/intermediates/javac/release/classes/com/vitalcorereactnative/BuildConfig.class
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream
CHANGED
|
Binary file
|
|
Binary file
|
package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.len
CHANGED
|
Binary file
|
package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at
CHANGED
|
Binary file
|
package/android/build/kotlin/compileReleaseKotlin/cacheable/caches-jvm/lookups/lookups.tab_i
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</td>
|
|
42
42
|
<td>
|
|
43
43
|
<div class="infoBox" id="duration">
|
|
44
|
-
<div class="counter">0.
|
|
44
|
+
<div class="counter">0.200s</div>
|
|
45
45
|
<p>duration</p>
|
|
46
46
|
</div>
|
|
47
47
|
</td>
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
</tr>
|
|
82
82
|
<tr>
|
|
83
83
|
<td class="success">canDeserializeGlucoseSamples</td>
|
|
84
|
-
<td class="success">0.
|
|
84
|
+
<td class="success">0.199s</td>
|
|
85
85
|
<td class="success">passed</td>
|
|
86
86
|
</tr>
|
|
87
87
|
</table>
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
|
95
95
|
</label>
|
|
96
96
|
</div>Generated by
|
|
97
|
-
<a href="http://www.gradle.org">Gradle 7.5.1</a> at
|
|
97
|
+
<a href="http://www.gradle.org">Gradle 7.5.1</a> at 18 Aug 2023, 21:22:21</p>
|
|
98
98
|
</div>
|
|
99
99
|
</div>
|
|
100
100
|
</body>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</td>
|
|
39
39
|
<td>
|
|
40
40
|
<div class="infoBox" id="duration">
|
|
41
|
-
<div class="counter">0.
|
|
41
|
+
<div class="counter">0.200s</div>
|
|
42
42
|
<p>duration</p>
|
|
43
43
|
</div>
|
|
44
44
|
</td>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
<td>2</td>
|
|
86
86
|
<td>0</td>
|
|
87
87
|
<td>0</td>
|
|
88
|
-
<td>0.
|
|
88
|
+
<td>0.200s</td>
|
|
89
89
|
<td class="success">100%</td>
|
|
90
90
|
</tr>
|
|
91
91
|
</tbody>
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
<td>2</td>
|
|
113
113
|
<td>0</td>
|
|
114
114
|
<td>0</td>
|
|
115
|
-
<td>0.
|
|
115
|
+
<td>0.200s</td>
|
|
116
116
|
<td class="success">100%</td>
|
|
117
117
|
</tr>
|
|
118
118
|
</tbody>
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
|
127
127
|
</label>
|
|
128
128
|
</div>Generated by
|
|
129
|
-
<a href="http://www.gradle.org">Gradle 7.5.1</a> at
|
|
129
|
+
<a href="http://www.gradle.org">Gradle 7.5.1</a> at 18 Aug 2023, 21:22:21</p>
|
|
130
130
|
</div>
|
|
131
131
|
</div>
|
|
132
132
|
</body>
|
package/android/build/reports/tests/testDebugUnitTest/packages/com.vitalcorereactnative.html
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</td>
|
|
41
41
|
<td>
|
|
42
42
|
<div class="infoBox" id="duration">
|
|
43
|
-
<div class="counter">0.
|
|
43
|
+
<div class="counter">0.200s</div>
|
|
44
44
|
<p>duration</p>
|
|
45
45
|
</div>
|
|
46
46
|
</td>
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
<td>2</td>
|
|
84
84
|
<td>0</td>
|
|
85
85
|
<td>0</td>
|
|
86
|
-
<td>0.
|
|
86
|
+
<td>0.200s</td>
|
|
87
87
|
<td class="success">100%</td>
|
|
88
88
|
</tr>
|
|
89
89
|
</table>
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
|
97
97
|
</label>
|
|
98
98
|
</div>Generated by
|
|
99
|
-
<a href="http://www.gradle.org">Gradle 7.5.1</a> at
|
|
99
|
+
<a href="http://www.gradle.org">Gradle 7.5.1</a> at 18 Aug 2023, 21:22:21</p>
|
|
100
100
|
</div>
|
|
101
101
|
</div>
|
|
102
102
|
</body>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</td>
|
|
42
42
|
<td>
|
|
43
43
|
<div class="infoBox" id="duration">
|
|
44
|
-
<div class="counter">0.
|
|
44
|
+
<div class="counter">0.176s</div>
|
|
45
45
|
<p>duration</p>
|
|
46
46
|
</div>
|
|
47
47
|
</td>
|
|
@@ -76,12 +76,12 @@
|
|
|
76
76
|
</thead>
|
|
77
77
|
<tr>
|
|
78
78
|
<td class="success">canDeserializeBloodPressureSamples</td>
|
|
79
|
-
<td class="success">0.
|
|
79
|
+
<td class="success">0.001s</td>
|
|
80
80
|
<td class="success">passed</td>
|
|
81
81
|
</tr>
|
|
82
82
|
<tr>
|
|
83
83
|
<td class="success">canDeserializeGlucoseSamples</td>
|
|
84
|
-
<td class="success">0.
|
|
84
|
+
<td class="success">0.175s</td>
|
|
85
85
|
<td class="success">passed</td>
|
|
86
86
|
</tr>
|
|
87
87
|
</table>
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
|
95
95
|
</label>
|
|
96
96
|
</div>Generated by
|
|
97
|
-
<a href="http://www.gradle.org">Gradle 7.5.1</a> at
|
|
97
|
+
<a href="http://www.gradle.org">Gradle 7.5.1</a> at 18 Aug 2023, 21:22:22</p>
|
|
98
98
|
</div>
|
|
99
99
|
</div>
|
|
100
100
|
</body>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</td>
|
|
39
39
|
<td>
|
|
40
40
|
<div class="infoBox" id="duration">
|
|
41
|
-
<div class="counter">0.
|
|
41
|
+
<div class="counter">0.176s</div>
|
|
42
42
|
<p>duration</p>
|
|
43
43
|
</div>
|
|
44
44
|
</td>
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
<td>2</td>
|
|
86
86
|
<td>0</td>
|
|
87
87
|
<td>0</td>
|
|
88
|
-
<td>0.
|
|
88
|
+
<td>0.176s</td>
|
|
89
89
|
<td class="success">100%</td>
|
|
90
90
|
</tr>
|
|
91
91
|
</tbody>
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
<td>2</td>
|
|
113
113
|
<td>0</td>
|
|
114
114
|
<td>0</td>
|
|
115
|
-
<td>0.
|
|
115
|
+
<td>0.176s</td>
|
|
116
116
|
<td class="success">100%</td>
|
|
117
117
|
</tr>
|
|
118
118
|
</tbody>
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
|
127
127
|
</label>
|
|
128
128
|
</div>Generated by
|
|
129
|
-
<a href="http://www.gradle.org">Gradle 7.5.1</a> at
|
|
129
|
+
<a href="http://www.gradle.org">Gradle 7.5.1</a> at 18 Aug 2023, 21:22:22</p>
|
|
130
130
|
</div>
|
|
131
131
|
</div>
|
|
132
132
|
</body>
|
package/android/build/reports/tests/testReleaseUnitTest/packages/com.vitalcorereactnative.html
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</td>
|
|
41
41
|
<td>
|
|
42
42
|
<div class="infoBox" id="duration">
|
|
43
|
-
<div class="counter">0.
|
|
43
|
+
<div class="counter">0.176s</div>
|
|
44
44
|
<p>duration</p>
|
|
45
45
|
</div>
|
|
46
46
|
</td>
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
<td>2</td>
|
|
84
84
|
<td>0</td>
|
|
85
85
|
<td>0</td>
|
|
86
|
-
<td>0.
|
|
86
|
+
<td>0.176s</td>
|
|
87
87
|
<td class="success">100%</td>
|
|
88
88
|
</tr>
|
|
89
89
|
</table>
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
|
|
97
97
|
</label>
|
|
98
98
|
</div>Generated by
|
|
99
|
-
<a href="http://www.gradle.org">Gradle 7.5.1</a> at
|
|
99
|
+
<a href="http://www.gradle.org">Gradle 7.5.1</a> at 18 Aug 2023, 21:22:22</p>
|
|
100
100
|
</div>
|
|
101
101
|
</div>
|
|
102
102
|
</body>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<testsuite name="com.vitalcorereactnative.SerializationTests" tests="2" skipped="0" failures="0" errors="0" timestamp="2023-08-
|
|
2
|
+
<testsuite name="com.vitalcorereactnative.SerializationTests" tests="2" skipped="0" failures="0" errors="0" timestamp="2023-08-18T20:22:20" hostname="meter.localdomain" time="0.2">
|
|
3
3
|
<properties/>
|
|
4
|
-
<testcase name="canDeserializeGlucoseSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.
|
|
4
|
+
<testcase name="canDeserializeGlucoseSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.199"/>
|
|
5
5
|
<testcase name="canDeserializeBloodPressureSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.001"/>
|
|
6
6
|
<system-out><![CDATA[]]></system-out>
|
|
7
7
|
<system-err><![CDATA[]]></system-err>
|
|
Binary file
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<testsuite name="com.vitalcorereactnative.SerializationTests" tests="2" skipped="0" failures="0" errors="0" timestamp="2023-
|
|
2
|
+
<testsuite name="com.vitalcorereactnative.SerializationTests" tests="2" skipped="0" failures="0" errors="0" timestamp="2023-08-18T20:22:21" hostname="meter.localdomain" time="0.176">
|
|
3
3
|
<properties/>
|
|
4
|
-
<testcase name="canDeserializeGlucoseSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.
|
|
5
|
-
<testcase name="canDeserializeBloodPressureSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.
|
|
4
|
+
<testcase name="canDeserializeGlucoseSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.175"/>
|
|
5
|
+
<testcase name="canDeserializeBloodPressureSamples" classname="com.vitalcorereactnative.SerializationTests" time="0.001"/>
|
|
6
6
|
<system-out><![CDATA[]]></system-out>
|
|
7
7
|
<system-err><![CDATA[]]></system-err>
|
|
8
8
|
</testsuite>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -12,6 +12,8 @@ import com.squareup.moshi.adapter
|
|
|
12
12
|
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
|
|
13
13
|
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
|
|
14
14
|
import io.tryvital.client.*
|
|
15
|
+
import io.tryvital.client.services.data.DataStage
|
|
16
|
+
import io.tryvital.client.services.data.IngestibleTimeseriesResource
|
|
15
17
|
import io.tryvital.client.services.data.ManualProviderSlug
|
|
16
18
|
import io.tryvital.client.services.data.ProviderSlug
|
|
17
19
|
import io.tryvital.client.services.data.Source
|
|
@@ -38,7 +40,7 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
38
40
|
ReactContextBaseJavaModule(reactContext) {
|
|
39
41
|
|
|
40
42
|
private val mainScope = MainScope()
|
|
41
|
-
|
|
43
|
+
val client: VitalClient get() = VitalClient.getOrCreate(reactApplicationContext)
|
|
42
44
|
|
|
43
45
|
override fun getName(): String {
|
|
44
46
|
return NAME
|
|
@@ -46,7 +48,9 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
46
48
|
|
|
47
49
|
@ReactMethod
|
|
48
50
|
fun setUserId(userId: String, promise: Promise) {
|
|
49
|
-
|
|
51
|
+
if (!client.isConfigured)
|
|
52
|
+
return promise.rejectCoreNotConfigured()
|
|
53
|
+
|
|
50
54
|
client.setUserId(userId)
|
|
51
55
|
promise.resolve(null)
|
|
52
56
|
}
|
|
@@ -56,9 +60,7 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
56
60
|
try {
|
|
57
61
|
VitalLogger.getOrCreate().enabled = enableLogs
|
|
58
62
|
|
|
59
|
-
|
|
60
|
-
reactApplicationContext,
|
|
61
|
-
// TODO: Expose these as enum constants in the RN SDK
|
|
63
|
+
VitalClient.getOrCreate(reactApplicationContext).configure(
|
|
62
64
|
region = Region.valueOf(region.uppercase()),
|
|
63
65
|
environment = Environment.valueOf(environment.lowercase().replaceFirstChar { it.uppercase() }),
|
|
64
66
|
apiKey = apiKey
|
|
@@ -72,7 +74,8 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
72
74
|
|
|
73
75
|
@ReactMethod
|
|
74
76
|
fun cleanUp(promise: Promise) {
|
|
75
|
-
|
|
77
|
+
if (!client.isConfigured)
|
|
78
|
+
return promise.rejectCoreNotConfigured()
|
|
76
79
|
|
|
77
80
|
mainScope.launch {
|
|
78
81
|
client.cleanUp()
|
|
@@ -82,7 +85,8 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
82
85
|
|
|
83
86
|
@ReactMethod
|
|
84
87
|
fun hasUserConnectedTo(provider: String, promise: Promise) {
|
|
85
|
-
|
|
88
|
+
if (!client.isConfigured)
|
|
89
|
+
return promise.rejectCoreNotConfigured()
|
|
86
90
|
|
|
87
91
|
val slug = try { ProviderSlug.fromJsonName(provider) } catch (e: IllegalArgumentException) {
|
|
88
92
|
return promise.reject(VITAL_CORE_ERROR, "Unrecognized provider slug: $provider")
|
|
@@ -93,7 +97,9 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
93
97
|
|
|
94
98
|
@ReactMethod
|
|
95
99
|
fun userConnectedSources(promise: Promise) {
|
|
96
|
-
|
|
100
|
+
if (!client.isConfigured)
|
|
101
|
+
return promise.rejectCoreNotConfigured()
|
|
102
|
+
|
|
97
103
|
val userId = client.currentUserId ?: return promise.rejectUserIDNotSet()
|
|
98
104
|
|
|
99
105
|
mainScope.launch {
|
|
@@ -120,7 +126,9 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
120
126
|
|
|
121
127
|
@ReactMethod
|
|
122
128
|
fun deregisterProvider(provider: String, promise: Promise) {
|
|
123
|
-
|
|
129
|
+
if (!client.isConfigured)
|
|
130
|
+
return promise.rejectCoreNotConfigured()
|
|
131
|
+
|
|
124
132
|
val userId = client.currentUserId ?: return promise.rejectUserIDNotSet()
|
|
125
133
|
|
|
126
134
|
val slug = try { ProviderSlug.fromJsonName(provider) } catch (e: IllegalArgumentException) {
|
|
@@ -142,7 +150,9 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
142
150
|
|
|
143
151
|
@ReactMethod
|
|
144
152
|
fun createConnectedSourceIfNotExist(provider: String, promise: Promise) {
|
|
145
|
-
|
|
153
|
+
if (!client.isConfigured)
|
|
154
|
+
return promise.rejectCoreNotConfigured()
|
|
155
|
+
|
|
146
156
|
val userId = client.currentUserId ?: return promise.rejectUserIDNotSet()
|
|
147
157
|
|
|
148
158
|
val slug = try { ManualProviderSlug.fromJsonName(provider) } catch (e: IllegalArgumentException) {
|
|
@@ -162,7 +172,9 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
162
172
|
@ReactMethod
|
|
163
173
|
@OptIn(ExperimentalStdlibApi::class)
|
|
164
174
|
fun postTimeSeriesData(jsonString: String, provider: String, timeZoneString: String?, promise: Promise) {
|
|
165
|
-
|
|
175
|
+
if (!client.isConfigured)
|
|
176
|
+
return promise.rejectCoreNotConfigured()
|
|
177
|
+
|
|
166
178
|
val userId = client.currentUserId ?: return promise.rejectUserIDNotSet()
|
|
167
179
|
|
|
168
180
|
val slug = try { ManualProviderSlug.fromJsonName(provider) } catch (e: IllegalArgumentException) {
|
|
@@ -189,7 +201,7 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
189
201
|
}
|
|
190
202
|
|
|
191
203
|
fun <T> makeTimeseriesPayload(data: T) = TimeseriesPayload(
|
|
192
|
-
stage =
|
|
204
|
+
stage = DataStage.Daily,
|
|
193
205
|
provider = slug,
|
|
194
206
|
startDate = null,
|
|
195
207
|
endDate = null,
|
|
@@ -201,9 +213,10 @@ class VitalCoreReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
201
213
|
try {
|
|
202
214
|
when (data) {
|
|
203
215
|
is ReactNativeTimeSeriesData.Glucose ->
|
|
204
|
-
client.vitalsService.
|
|
216
|
+
client.vitalsService.sendQuantitySamples(
|
|
205
217
|
userId = userId,
|
|
206
|
-
|
|
218
|
+
resource = IngestibleTimeseriesResource.BloodGlucose,
|
|
219
|
+
timeseriesPayload = makeTimeseriesPayload(
|
|
207
220
|
data.samples.map { it.payload }
|
|
208
221
|
)
|
|
209
222
|
)
|