react-native-spike-sdk 2.3.0 → 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 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
- #import <SpikeSDK/SpikeSDK-Swift.h>
333
+ import <SpikeSDK/SpikeSDK-Swift.h>
332
334
  ...
333
335
 
334
336
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -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, Promise>? = null
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
- checkPermissionsGranted(
456
- it.first,
457
- it.second,
458
- it.third
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-spike-sdk",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Spike API for health and productivity data from wearables and IoT devices",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -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.3.0"
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