react-native-spike-sdk 2.2.11 → 2.3.1
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/README.md +3 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/spikesdk/SpikeMappers.kt +2 -2
- package/android/src/main/java/com/spikesdk/SpikeSdkModule.kt +24 -7
- package/ios/SpikeSdk.xcodeproj/project.xcworkspace/xcuserdata/ekroman.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/lib/typescript/DataModels/SpikeData.d.ts +5 -4
- package/lib/typescript/DataModels/SpikeData.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-spike-sdk.podspec +2 -2
- package/src/DataModels/SpikeData.ts +5 -4
package/README.md
CHANGED
|
@@ -327,8 +327,10 @@ Under your project `Signing & Capabilities` section enable `Background Delivery`
|
|
|
327
327
|
Call Spike configure methods on each app start to trigger background deliveries tasks.
|
|
328
328
|
Add Spike initialization code to `ios/<Project Name>/AppDelegate.mm` file inside `application:didFinishLaunchingWithOptions:` method.
|
|
329
329
|
|
|
330
|
+
> If you plan on supporting background delivery, you need to set up all observer queries in your app delegate. Spike SDK will do it by calling `configure()` method. Read more [Receive Background Updates](https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery#3801028).
|
|
331
|
+
|
|
330
332
|
```javascript
|
|
331
|
-
|
|
333
|
+
import <SpikeSDK/SpikeSDK-Swift.h>
|
|
332
334
|
...
|
|
333
335
|
|
|
334
336
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
package/android/build.gradle
CHANGED
|
@@ -76,7 +76,7 @@ dependencies {
|
|
|
76
76
|
//noinspection GradleDynamicVersion
|
|
77
77
|
implementation "com.facebook.react:react-android:0.71.3"
|
|
78
78
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
79
|
-
implementation 'com.spikeapi.sdk:spike-sdk:3.0.
|
|
79
|
+
implementation 'com.spikeapi.sdk:spike-sdk:3.0.11'
|
|
80
80
|
implementation 'androidx.core:core-ktx:1.9.0'
|
|
81
81
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
|
|
82
82
|
implementation 'com.google.code.gson:gson:2.10.1'
|
|
@@ -27,7 +27,7 @@ fun SpikeDataType<out SpikeData>.toStringType(): String = when (this) {
|
|
|
27
27
|
SpikeDataTypes.HEART_RATE -> "heart"
|
|
28
28
|
SpikeDataTypes.SLEEP -> "sleep"
|
|
29
29
|
SpikeDataTypes.STEPS -> "steps"
|
|
30
|
-
SpikeDataTypes.
|
|
30
|
+
SpikeDataTypes.STEPS_INTRADAY -> "steps_intraday"
|
|
31
31
|
SpikeDataTypes.ACTIVITIES_STREAM -> "activities_stream"
|
|
32
32
|
SpikeDataTypes.ACTIVITIES_SUMMARY -> "activities_summary"
|
|
33
33
|
SpikeDataTypes.BREATHING -> "breathing"
|
|
@@ -43,7 +43,7 @@ fun String.toSpikeDataType(): SpikeDataType<out SpikeData> = when (this) {
|
|
|
43
43
|
"heart" -> SpikeDataTypes.HEART_RATE
|
|
44
44
|
"sleep" -> SpikeDataTypes.SLEEP
|
|
45
45
|
"steps" -> SpikeDataTypes.STEPS
|
|
46
|
-
"steps_intraday" -> SpikeDataTypes.
|
|
46
|
+
"steps_intraday" -> SpikeDataTypes.STEPS_INTRADAY
|
|
47
47
|
"activities_stream" -> SpikeDataTypes.ACTIVITIES_STREAM
|
|
48
48
|
"activities_summary" -> SpikeDataTypes.ACTIVITIES_SUMMARY
|
|
49
49
|
"breathing" -> SpikeDataTypes.BREATHING
|
|
@@ -40,7 +40,7 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
40
40
|
OffsetDateTime::class.java,
|
|
41
41
|
OffsetDateTimeSerializer()
|
|
42
42
|
).create()
|
|
43
|
-
private var checkPermissionsFor: Triple<String, String
|
|
43
|
+
private var checkPermissionsFor: Triple<String, Set<String>, Promise>? = null
|
|
44
44
|
|
|
45
45
|
override fun getName(): String {
|
|
46
46
|
return NAME
|
|
@@ -373,7 +373,7 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
373
373
|
} else {
|
|
374
374
|
val activity = reactApplicationContext.currentActivity
|
|
375
375
|
if (activity is ComponentActivity) {
|
|
376
|
-
checkPermissionsFor = Triple(connectionUUID, dataType, promise)
|
|
376
|
+
checkPermissionsFor = Triple(connectionUUID, setOf(dataType), promise)
|
|
377
377
|
val launcher =
|
|
378
378
|
activity.registerActivityResultLauncher(
|
|
379
379
|
SpikeConnection.requestReadAuthorization()
|
|
@@ -413,6 +413,21 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
413
413
|
REQUEST_CODE
|
|
414
414
|
)
|
|
415
415
|
promise.resolve(true)
|
|
416
|
+
} else {
|
|
417
|
+
val activity = reactApplicationContext.currentActivity
|
|
418
|
+
if (activity is ComponentActivity) {
|
|
419
|
+
checkPermissionsFor = Triple(connectionUUID, dataTypes.toArrayList().toSet() as Set<String>, promise)
|
|
420
|
+
val launcher =
|
|
421
|
+
activity.registerActivityResultLauncher(
|
|
422
|
+
SpikeConnection.requestReadAuthorization()
|
|
423
|
+
) {
|
|
424
|
+
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
launcher.launch(permissions)
|
|
428
|
+
} else {
|
|
429
|
+
promise.resolve(false)
|
|
430
|
+
}
|
|
416
431
|
}
|
|
417
432
|
}
|
|
418
433
|
|
|
@@ -452,11 +467,13 @@ class SpikeSdkModule(reactContext: ReactApplicationContext) :
|
|
|
452
467
|
}
|
|
453
468
|
override fun onHostResume() {
|
|
454
469
|
checkPermissionsFor?.let {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
470
|
+
it.second.forEach { permission ->
|
|
471
|
+
checkPermissionsGranted(
|
|
472
|
+
it.first,
|
|
473
|
+
permission,
|
|
474
|
+
it.third
|
|
475
|
+
)
|
|
476
|
+
}
|
|
460
477
|
}
|
|
461
478
|
checkPermissionsFor = null
|
|
462
479
|
}
|
|
Binary file
|
|
@@ -11,16 +11,17 @@ import type { SpikeSleepDataEntry } from './SpikeSleepDataEntry';
|
|
|
11
11
|
import type { SpikeStepsDataEntry } from './SpikeStepsDataEntry';
|
|
12
12
|
export type SpikeDataEntry = SpikeActivitiesSummaryDataEntry | SpikeActivitiesStreamDataEntry | SpikeBreathingDataEntry | SpikeCaloriesDataEntry | SpikeDistanceDataEntry | SpikeGlucoseDataEntry | SpikeHeartDataEntry | SpikeOxygenSaturationDataEntry | SpikeSleepDataEntry | SpikeStepsDataEntry | SpikeBodyDataEntry;
|
|
13
13
|
export interface SpikeData<DataEntry extends SpikeDataEntry> {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
dateFrom: string;
|
|
15
|
+
dateTo: string;
|
|
16
|
+
collectedAt: string;
|
|
16
17
|
endUserId: string;
|
|
17
|
-
collectedAt: Date;
|
|
18
18
|
sources: SpikeSource[];
|
|
19
19
|
entries: DataEntry[];
|
|
20
20
|
}
|
|
21
21
|
interface SpikeSource {
|
|
22
22
|
name: string;
|
|
23
|
-
|
|
23
|
+
isSuccess: boolean;
|
|
24
|
+
message: string;
|
|
24
25
|
}
|
|
25
26
|
export {};
|
|
26
27
|
//# sourceMappingURL=SpikeData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpikeData.d.ts","sourceRoot":"","sources":["../../../src/DataModels/SpikeData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AACvF,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B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AACvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,MAAM,MAAM,cAAc,GACtB,+BAA+B,GAC/B,8BAA8B,GAC9B,uBAAuB,GACvB,sBAAsB,GACtB,sBAAsB,GACtB,qBAAqB,GACrB,mBAAmB,GACnB,8BAA8B,GAC9B,mBAAmB,GACnB,mBAAmB,GACnB,kBAAkB,CAAC;AACvB,MAAM,WAAW,SAAS,CAAC,SAAS,SAAS,cAAc;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
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 = "2.
|
|
8
|
+
s.version = "2.3.1"
|
|
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", "~> 2.
|
|
28
|
+
s.dependency "SpikeSDK", "~> 2.2.0"
|
|
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
|
|
@@ -23,15 +23,16 @@ export type SpikeDataEntry =
|
|
|
23
23
|
| SpikeStepsDataEntry
|
|
24
24
|
| SpikeBodyDataEntry;
|
|
25
25
|
export interface SpikeData<DataEntry extends SpikeDataEntry> {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
dateFrom: string;
|
|
27
|
+
dateTo: string;
|
|
28
|
+
collectedAt: string;
|
|
28
29
|
endUserId: string;
|
|
29
|
-
collectedAt: Date;
|
|
30
30
|
sources: SpikeSource[];
|
|
31
31
|
entries: DataEntry[];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
interface SpikeSource {
|
|
35
35
|
name: string;
|
|
36
|
-
|
|
36
|
+
isSuccess: boolean;
|
|
37
|
+
message: string;
|
|
37
38
|
}
|