react-native-spike-sdk 1.0.14 → 1.0.16
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.gradle +1 -1
- package/android/src/main/java/com/spikesdk/OffsetDateTimeSerializer.kt +19 -0
- package/android/src/main/java/com/spikesdk/SpikeSdkModule.kt +13 -12
- package/lib/typescript/DataModels/SpikeBodyDataEntry.d.ts +7 -15
- package/lib/typescript/DataModels/SpikeBodyDataEntry.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-spike-sdk.podspec +2 -2
- package/src/DataModels/SpikeBodyDataEntry.ts +7 -17
package/android/build.gradle
CHANGED
|
@@ -80,7 +80,7 @@ dependencies {
|
|
|
80
80
|
//noinspection GradleDynamicVersion
|
|
81
81
|
implementation "com.facebook.react:react-android:0.71.3"
|
|
82
82
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
83
|
-
implementation "com.spikeapi.sdk:spike-sdk:1.1.
|
|
83
|
+
implementation "com.spikeapi.sdk:spike-sdk:1.1.5"
|
|
84
84
|
implementation 'androidx.core:core-ktx:1.9.0'
|
|
85
85
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
|
|
86
86
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
package com.spikesdk
|
|
2
|
+
|
|
3
|
+
import com.google.gson.JsonElement
|
|
4
|
+
import com.google.gson.JsonPrimitive
|
|
5
|
+
import com.google.gson.JsonSerializationContext
|
|
6
|
+
import com.google.gson.JsonSerializer
|
|
7
|
+
import java.lang.reflect.Type
|
|
8
|
+
import java.time.OffsetDateTime
|
|
9
|
+
|
|
10
|
+
internal class OffsetDateTimeSerializer : JsonSerializer<OffsetDateTime?> {
|
|
11
|
+
override fun serialize(
|
|
12
|
+
offsetDateTime: OffsetDateTime?,
|
|
13
|
+
srcType: Type?,
|
|
14
|
+
context: JsonSerializationContext?
|
|
15
|
+
): JsonElement {
|
|
16
|
+
return JsonPrimitive(offsetDateTime.toString())
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReactMethod
|
|
|
8
8
|
import com.facebook.react.bridge.WritableMap
|
|
9
9
|
import com.facebook.react.bridge.WritableNativeMap
|
|
10
10
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
11
|
+
import com.google.gson.FieldNamingPolicy
|
|
11
12
|
import com.google.gson.GsonBuilder
|
|
12
13
|
import com.google.gson.JsonDeserializer
|
|
13
14
|
import com.spikeapi.SpikeConnection
|
|
@@ -27,12 +28,12 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
27
28
|
|
|
28
29
|
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
|
29
30
|
|
|
30
|
-
private val gson = GsonBuilder()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
OffsetDateTime.
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
private val gson = GsonBuilder()
|
|
32
|
+
.setPrettyPrinting()
|
|
33
|
+
.registerTypeAdapter(
|
|
34
|
+
OffsetDateTime::class.java,
|
|
35
|
+
OffsetDateTimeSerializer()
|
|
36
|
+
).create()
|
|
36
37
|
|
|
37
38
|
override fun getName(): String {
|
|
38
39
|
return NAME
|
|
@@ -116,11 +117,12 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
116
117
|
@ReactMethod
|
|
117
118
|
fun getCallbackUrl(uuid: String, promise: Promise) {
|
|
118
119
|
try {
|
|
119
|
-
val connection =
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
val connection =
|
|
121
|
+
(connections[uuid] as? SpikeWebhookConnection) ?: return promise.reject(
|
|
122
|
+
SpikeExceptions.SpikeException(
|
|
123
|
+
"Connection not found"
|
|
124
|
+
).mapException(), "Connection not found"
|
|
125
|
+
)
|
|
124
126
|
val callbackUrl = connection.getPostbackUrl()
|
|
125
127
|
promise.resolve(callbackUrl)
|
|
126
128
|
} catch (e: SpikeExceptions) {
|
|
@@ -129,7 +131,6 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
|
|
132
|
-
|
|
133
134
|
@ReactMethod
|
|
134
135
|
fun close(uuid: String, promise: Promise) {
|
|
135
136
|
scope.launch {
|
|
@@ -24,25 +24,17 @@ type BodyDataObjectItem = {
|
|
|
24
24
|
value?: number;
|
|
25
25
|
};
|
|
26
26
|
type TemperatureData = {
|
|
27
|
-
skin_temperature?:
|
|
28
|
-
core_temperature?:
|
|
27
|
+
skin_temperature?: TemperatureDataObject;
|
|
28
|
+
core_temperature?: TemperatureDataObject;
|
|
29
|
+
baseline_skin_temperature?: TemperatureDataObject;
|
|
30
|
+
baseline_core_temperature?: TemperatureDataObject;
|
|
29
31
|
diff_from_baseline_temperature?: DiffTemperatureDataObject;
|
|
30
32
|
};
|
|
31
|
-
type
|
|
33
|
+
type TemperatureDataObject = {
|
|
32
34
|
temperature_celsius?: number;
|
|
33
|
-
|
|
34
|
-
timeseries?: SkinTemperatureDataObjectItem[];
|
|
35
|
+
timeseries?: TemperatureDataObjectItem[];
|
|
35
36
|
};
|
|
36
|
-
type
|
|
37
|
-
timestamp?: string;
|
|
38
|
-
temperature_celsius?: number;
|
|
39
|
-
};
|
|
40
|
-
type CoreTemperatureDataObject = {
|
|
41
|
-
temperature_celsius?: number;
|
|
42
|
-
baseline_core_temperature?: number;
|
|
43
|
-
timeseries?: CoreTemperatureDataObjectItem[];
|
|
44
|
-
};
|
|
45
|
-
type CoreTemperatureDataObjectItem = {
|
|
37
|
+
type TemperatureDataObjectItem = {
|
|
46
38
|
timestamp?: string;
|
|
47
39
|
temperature_celsius?: number;
|
|
48
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpikeBodyDataEntry.d.ts","sourceRoot":"","sources":["../../../src/DataModels/SpikeBodyDataEntry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACd,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACnC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,gBAAgB,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"SpikeBodyDataEntry.d.ts","sourceRoot":"","sources":["../../../src/DataModels/SpikeBodyDataEntry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,gBAAgB,CAAC,EAAE,eAAe,CAAC;IACnC,mBAAmB,CAAC,EAAE,uBAAuB,EAAE,CA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,MAAM,CAAC;IACnB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB,EAAE,MAAM,CAAC;IAChC,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1
|
|
|
5
5
|
|
|
6
6
|
Pod::Spec.new do |s|
|
|
7
7
|
s.name = "react-native-spike-sdk"
|
|
8
|
-
s.version = "1.0.
|
|
8
|
+
s.version = "1.0.16"
|
|
9
9
|
s.summary = "Spike API for health and productivity data from wearables and IoT devices"
|
|
10
10
|
|
|
11
11
|
s.description = <<-DESC
|
|
@@ -25,7 +25,7 @@ Pod::Spec.new do |s|
|
|
|
25
25
|
s.swift_version = "5"
|
|
26
26
|
|
|
27
27
|
s.dependency "React-Core"
|
|
28
|
-
s.dependency "SpikeSDK", "1.0.
|
|
28
|
+
s.dependency "SpikeSDK", "1.0.18"
|
|
29
29
|
|
|
30
30
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
31
31
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
@@ -28,29 +28,19 @@ type BodyDataObjectItem = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
type TemperatureData = {
|
|
31
|
-
skin_temperature?:
|
|
32
|
-
core_temperature?:
|
|
31
|
+
skin_temperature?: TemperatureDataObject;
|
|
32
|
+
core_temperature?: TemperatureDataObject;
|
|
33
|
+
baseline_skin_temperature?: TemperatureDataObject;
|
|
34
|
+
baseline_core_temperature?: TemperatureDataObject;
|
|
33
35
|
diff_from_baseline_temperature?: DiffTemperatureDataObject;
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
type
|
|
38
|
+
type TemperatureDataObject = {
|
|
37
39
|
temperature_celsius?: number;
|
|
38
|
-
|
|
39
|
-
timeseries?: SkinTemperatureDataObjectItem[];
|
|
40
|
+
timeseries?: TemperatureDataObjectItem[];
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
type
|
|
43
|
-
timestamp?: string;
|
|
44
|
-
temperature_celsius?: number;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
type CoreTemperatureDataObject = {
|
|
48
|
-
temperature_celsius?: number;
|
|
49
|
-
baseline_core_temperature?: number;
|
|
50
|
-
timeseries?: CoreTemperatureDataObjectItem[];
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
type CoreTemperatureDataObjectItem = {
|
|
43
|
+
type TemperatureDataObjectItem = {
|
|
54
44
|
timestamp?: string;
|
|
55
45
|
temperature_celsius?: number;
|
|
56
46
|
};
|