@tryvital/vital-health-react-native 5.4.2 → 5.4.3

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.
@@ -1,4 +1,4 @@
1
- VitalHealthReactNative_kotlinVersion=1.8.10
1
+ VitalHealthReactNative_kotlinVersion=2.0.21
2
2
  VitalHealthReactNative_minSdkVersion=26
3
3
  VitalHealthReactNative_targetSdkVersion=31
4
4
  VitalHealthReactNative_compileSdkVersion=31
@@ -114,7 +114,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
114
114
  )
115
115
  }
116
116
 
117
- val activity = currentActivity ?: return@runOnMain promise.reject(
117
+ val activity = reactApplicationContext.currentActivity ?: return@runOnMain promise.reject(
118
118
  VITAL_HEALTH_ERROR,
119
119
  "Cannot find the current ReactNative Activity"
120
120
  )
@@ -260,7 +260,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
260
260
  )
261
261
  }
262
262
 
263
- val activity = currentActivity ?: return@runOnMain promise.reject(
263
+ val activity = reactApplicationContext.currentActivity ?: return@runOnMain promise.reject(
264
264
  VITAL_HEALTH_ERROR,
265
265
  "Cannot find the current ReactNative Activity"
266
266
  )
@@ -374,7 +374,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
374
374
 
375
375
  @ReactMethod
376
376
  fun openPlatformHealthApp(promise: Promise) = runOnMain {
377
- val activity = currentActivity ?: return@runOnMain promise.reject(
377
+ val activity = reactApplicationContext.currentActivity ?: return@runOnMain promise.reject(
378
378
  VITAL_HEALTH_ERROR,
379
379
  "No active Android Activity"
380
380
  )
@@ -513,7 +513,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
513
513
  val module = reactInstanceManager.currentReactContext?.getNativeModule(VitalHealthReactNativeModule::class.java) ?: return
514
514
 
515
515
  if (synchronized(module) { module.askForPermission != null }) {
516
- val activity = module.currentActivity as ComponentActivity
516
+ val activity = module.reactApplicationContext.currentActivity as? ComponentActivity ?: return
517
517
 
518
518
  // Lifted from ComponentActivity.onRequestPermissionsResult
519
519
  activity.activityResultRegistry.dispatchResult(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-health-react-native",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "Client to access iOS's HealthKit and Android HealthConnect",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -50,7 +50,7 @@
50
50
  "registry": "https://registry.npmjs.org/"
51
51
  },
52
52
  "dependencies": {
53
- "@tryvital/vital-core-react-native": "5.4.2"
53
+ "@tryvital/vital-core-react-native": "5.4.3"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "*",