@tryvital/vital-health-react-native 5.4.2 → 5.5.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.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/vitalhealthreactnative/VitalHealthReactNativeModule.kt +11 -7
- package/app.plugin.js +2 -2
- package/lib/commonjs/app.plugin.js +2 -2
- package/package.json +4 -3
- package/vital-health-react-native.podspec +2 -17
package/android/build.gradle
CHANGED
|
@@ -24,6 +24,11 @@ import io.tryvital.vitalhealthconnect.disableBackgroundSync
|
|
|
24
24
|
import io.tryvital.vitalhealthconnect.enableBackgroundSyncContract
|
|
25
25
|
import io.tryvital.vitalhealthconnect.isBackgroundSyncEnabled
|
|
26
26
|
import io.tryvital.vitalhealthconnect.model.*
|
|
27
|
+
import io.tryvital.vitalhealthcore.model.ConnectionPolicy
|
|
28
|
+
import io.tryvital.vitalhealthcore.model.ProviderAvailability
|
|
29
|
+
import io.tryvital.vitalhealthcore.model.SyncStatus
|
|
30
|
+
import io.tryvital.vitalhealthcore.model.VitalResource
|
|
31
|
+
import io.tryvital.vitalhealthcore.model.WritableVitalResource
|
|
27
32
|
import kotlinx.coroutines.*
|
|
28
33
|
import kotlinx.coroutines.flow.launchIn
|
|
29
34
|
import kotlinx.coroutines.flow.onEach
|
|
@@ -32,7 +37,6 @@ import kotlinx.serialization.json.Json
|
|
|
32
37
|
import kotlinx.serialization.json.JsonObject
|
|
33
38
|
import kotlinx.serialization.json.jsonPrimitive
|
|
34
39
|
import java.time.Instant
|
|
35
|
-
import java.util.Locale
|
|
36
40
|
import java.util.concurrent.atomic.AtomicReference
|
|
37
41
|
import kotlin.time.Duration.Companion.milliseconds
|
|
38
42
|
|
|
@@ -60,7 +64,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
60
64
|
@ReactMethod
|
|
61
65
|
fun isAvailable(promise: Promise) = runOnMain {
|
|
62
66
|
val availability = VitalHealthConnectManager.isAvailable(reactApplicationContext)
|
|
63
|
-
promise.resolve(availability ==
|
|
67
|
+
promise.resolve(availability == ProviderAvailability.Installed)
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
@ReactMethod
|
|
@@ -75,7 +79,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
75
79
|
|
|
76
80
|
val availability = VitalHealthConnectManager.isAvailable(reactApplicationContext)
|
|
77
81
|
|
|
78
|
-
if (availability !=
|
|
82
|
+
if (availability != ProviderAvailability.Installed) {
|
|
79
83
|
return@runOnMain promise.reject(
|
|
80
84
|
VITAL_HEALTH_ERROR,
|
|
81
85
|
"Health Connect is unavailable: $availability",
|
|
@@ -114,7 +118,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
114
118
|
)
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
val activity = currentActivity ?: return@runOnMain promise.reject(
|
|
121
|
+
val activity = reactApplicationContext.currentActivity ?: return@runOnMain promise.reject(
|
|
118
122
|
VITAL_HEALTH_ERROR,
|
|
119
123
|
"Cannot find the current ReactNative Activity"
|
|
120
124
|
)
|
|
@@ -260,7 +264,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
260
264
|
)
|
|
261
265
|
}
|
|
262
266
|
|
|
263
|
-
val activity = currentActivity ?: return@runOnMain promise.reject(
|
|
267
|
+
val activity = reactApplicationContext.currentActivity ?: return@runOnMain promise.reject(
|
|
264
268
|
VITAL_HEALTH_ERROR,
|
|
265
269
|
"Cannot find the current ReactNative Activity"
|
|
266
270
|
)
|
|
@@ -374,7 +378,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
374
378
|
|
|
375
379
|
@ReactMethod
|
|
376
380
|
fun openPlatformHealthApp(promise: Promise) = runOnMain {
|
|
377
|
-
val activity = currentActivity ?: return@runOnMain promise.reject(
|
|
381
|
+
val activity = reactApplicationContext.currentActivity ?: return@runOnMain promise.reject(
|
|
378
382
|
VITAL_HEALTH_ERROR,
|
|
379
383
|
"No active Android Activity"
|
|
380
384
|
)
|
|
@@ -513,7 +517,7 @@ class VitalHealthReactNativeModule(reactContext: ReactApplicationContext) :
|
|
|
513
517
|
val module = reactInstanceManager.currentReactContext?.getNativeModule(VitalHealthReactNativeModule::class.java) ?: return
|
|
514
518
|
|
|
515
519
|
if (synchronized(module) { module.askForPermission != null }) {
|
|
516
|
-
val activity = module.currentActivity as ComponentActivity
|
|
520
|
+
val activity = module.reactApplicationContext.currentActivity as? ComponentActivity ?: return
|
|
517
521
|
|
|
518
522
|
// Lifted from ComponentActivity.onRequestPermissionsResult
|
|
519
523
|
activity.activityResultRegistry.dispatchResult(
|
package/app.plugin.js
CHANGED
|
@@ -3,8 +3,8 @@ const {
|
|
|
3
3
|
withInfoPlist,
|
|
4
4
|
withAndroidManifest,
|
|
5
5
|
withAppDelegate,
|
|
6
|
-
} = require('
|
|
7
|
-
const { withPlugins } = require('
|
|
6
|
+
} = require('expo/config-plugins');
|
|
7
|
+
const { withPlugins } = require('expo/config-plugins');
|
|
8
8
|
const { addObjcImports, insertContentsInsideObjcFunctionBlock, addSwiftImports, insertContentsInsideSwiftFunctionBlock } = require('@expo/config-plugins/build/ios/codeMod');
|
|
9
9
|
|
|
10
10
|
const HEALTH_SHARE = 'Allow $(PRODUCT_NAME) to check health info';
|
|
@@ -3,8 +3,8 @@ const {
|
|
|
3
3
|
withInfoPlist,
|
|
4
4
|
withAndroidManifest,
|
|
5
5
|
withAppDelegate,
|
|
6
|
-
} = require('
|
|
7
|
-
const { withPlugins } = require('
|
|
6
|
+
} = require('expo/config-plugins');
|
|
7
|
+
const { withPlugins } = require('expo/config-plugins');
|
|
8
8
|
const { addObjcImports, insertContentsInsideObjcFunctionBlock, addSwiftImports, insertContentsInsideSwiftFunctionBlock } = require('@expo/config-plugins/build/ios/codeMod');
|
|
9
9
|
|
|
10
10
|
const HEALTH_SHARE = 'Allow $(PRODUCT_NAME) to check health info';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryvital/vital-health-react-native",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
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,11 +50,12 @@
|
|
|
50
50
|
"registry": "https://registry.npmjs.org/"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@tryvital/vital-core-react-native": "5.
|
|
53
|
+
"@tryvital/vital-core-react-native": "5.5.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": "*",
|
|
57
|
-
"react-native": "*"
|
|
57
|
+
"react-native": "*",
|
|
58
|
+
"expo": "*"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@react-native-community/eslint-config": "^3.0.2",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
4
|
|
|
6
5
|
Pod::Spec.new do |s|
|
|
7
6
|
s.name = "vital-health-react-native"
|
|
@@ -16,21 +15,7 @@ Pod::Spec.new do |s|
|
|
|
16
15
|
|
|
17
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
17
|
|
|
19
|
-
s.dependency "
|
|
20
|
-
s.dependency "VitalHealthKit", "~> 1.8.2"
|
|
18
|
+
s.dependency "VitalHealthKit", "~> 1.8.6"
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
24
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
25
|
-
s.pod_target_xcconfig = {
|
|
26
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
27
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
28
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
29
|
-
}
|
|
30
|
-
s.dependency "React-Codegen"
|
|
31
|
-
s.dependency "RCT-Folly"
|
|
32
|
-
s.dependency "RCTRequired"
|
|
33
|
-
s.dependency "RCTTypeSafety"
|
|
34
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
35
|
-
end
|
|
20
|
+
install_modules_dependencies(s)
|
|
36
21
|
end
|