@tryvital/vital-health-react-native 1.4.0 → 1.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.
@@ -5,18 +5,23 @@ import Combine
5
5
  @objc(VitalHealthReactNative)
6
6
  class VitalHealthReactNative: RCTEventEmitter {
7
7
 
8
- public static var status: RCTEventEmitter!
9
8
  public var cancellable: AnyCancellable?
10
9
 
10
+ /// Whether or not this native module is active & not invalidated.
11
+ var isActive: Bool {
12
+ callableJSModules != nil
13
+ }
14
+
11
15
  deinit {
12
16
  cancellable?.cancel()
13
17
  }
14
18
 
15
19
  override init() {
16
20
  super.init()
17
- VitalHealthReactNative.status = self
18
21
 
19
- cancellable = VitalHealthKitClient.shared.status.sink { status in
22
+ cancellable = VitalHealthKitClient.shared.status.sink { [weak self] status in
23
+ guard let self = self, self.isActive else { return }
24
+
20
25
  var payload: [String: String] = [:]
21
26
 
22
27
  switch status {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryvital/vital-health-react-native",
3
- "version": "1.4.0",
3
+ "version": "1.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",
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency "VitalHealthKit", "~> 0.9.1"
20
+ s.dependency "VitalHealthKit", "~> 0.9.4"
21
21
 
22
22
  # Don't install the dependencies when we run `pod install` in the old architecture.
23
23
  if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then