@kingstinct/react-native-healthkit 14.1.0 → 15.1.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.
Files changed (71) hide show
  1. package/README.md +32 -2
  2. package/app.plugin.js +49 -94
  3. package/app.plugin.ts +6 -56
  4. package/ios/BackgroundDeliveryManager.swift +13 -6
  5. package/ios/BackgroundLaunchHook.mm +41 -0
  6. package/ios/Constants.swift +24 -0
  7. package/ios/CoreModule.swift +5 -1
  8. package/ios/Helpers.swift +29 -1
  9. package/ios/MemoryEstimation.swift +83 -0
  10. package/ios/QuantityTypeModule.swift +34 -26
  11. package/ios/Serializers.swift +18 -3
  12. package/ios/SourceProxy.swift +14 -5
  13. package/ios/WorkoutProxy.swift +28 -11
  14. package/lib/commonjs/generated/healthkit.generated.js +13 -3
  15. package/lib/commonjs/healthkit.ios.js +3 -1
  16. package/lib/commonjs/healthkit.js +4 -2
  17. package/lib/module/generated/healthkit.generated.js +12 -2
  18. package/lib/module/healthkit.ios.js +2 -0
  19. package/lib/module/healthkit.js +2 -0
  20. package/lib/typescript/generated/healthkit.generated.d.ts +17 -7
  21. package/lib/typescript/healthkit.d.ts +1 -0
  22. package/lib/typescript/healthkit.ios.d.ts +2 -0
  23. package/lib/typescript/specs/CoreModule.nitro.d.ts +6 -4
  24. package/lib/typescript/specs/SourceProxy.nitro.d.ts +1 -2
  25. package/lib/typescript/types/QuantityType.d.ts +3 -3
  26. package/lib/typescript/types/Source.d.ts +2 -2
  27. package/lib/typescript/types/Units.d.ts +1 -1
  28. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +16 -16
  29. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +23 -12
  30. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +7 -4
  31. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +7 -4
  32. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +7 -4
  33. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +7 -4
  34. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +7 -4
  35. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +7 -4
  36. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +7 -4
  37. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +3 -4
  38. package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +6 -3
  39. package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +8 -0
  40. package/nitrogen/generated/ios/swift/CategoryTypeIdentifierWriteable.swift +8 -0
  41. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +8 -4
  42. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +0 -4
  43. package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +0 -4
  44. package/nitrogen/generated/ios/swift/QueryStatisticsResponse.swift +6 -13
  45. package/nitrogen/generated/ios/swift/QueryStatisticsResponseFromSingleSource.swift +4 -11
  46. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +8 -4
  47. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +8 -4
  48. package/nitrogen/generated/ios/swift/SourceRevision.swift +4 -11
  49. package/nitrogen/generated/ios/swift/WorkoutActivityType.swift +8 -0
  50. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +67 -59
  51. package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +67 -59
  52. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +202 -198
  53. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +107 -111
  54. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +107 -111
  55. package/nitrogen/generated/shared/c++/QueryStatisticsResponse.hpp +8 -9
  56. package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +8 -9
  57. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +195 -191
  58. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +189 -185
  59. package/nitrogen/generated/shared/c++/SourceRevision.hpp +8 -9
  60. package/nitrogen/generated/shared/c++/WorkoutActivityType.hpp +4 -0
  61. package/package.json +5 -3
  62. package/src/generated/healthkit-schema.json +45 -8
  63. package/src/generated/healthkit.generated.ts +18 -6
  64. package/src/healthkit.ios.ts +3 -0
  65. package/src/healthkit.ts +5 -0
  66. package/src/specs/CoreModule.nitro.ts +6 -4
  67. package/src/specs/SourceProxy.nitro.ts +1 -1
  68. package/src/type-tests/generated-typing.ts +30 -8
  69. package/src/types/QuantityType.ts +3 -3
  70. package/src/types/Source.ts +2 -2
  71. package/src/types/Units.ts +1 -1
@@ -32,15 +32,14 @@
32
32
  namespace margelo::nitro::healthkit { struct Quantity; }
33
33
  // Forward declaration of `QuantityDateInterval` to properly resolve imports.
34
34
  namespace margelo::nitro::healthkit { struct QuantityDateInterval; }
35
- // Forward declaration of `HybridSourceProxySpec` to properly resolve imports.
36
- namespace margelo::nitro::healthkit { class HybridSourceProxySpec; }
35
+ // Forward declaration of `Source` to properly resolve imports.
36
+ namespace margelo::nitro::healthkit { struct Source; }
37
37
 
38
38
  #include "Quantity.hpp"
39
39
  #include <optional>
40
40
  #include "QuantityDateInterval.hpp"
41
41
  #include <chrono>
42
- #include <memory>
43
- #include "HybridSourceProxySpec.hpp"
42
+ #include "Source.hpp"
44
43
  #include <vector>
45
44
 
46
45
  namespace margelo::nitro::healthkit {
@@ -59,11 +58,11 @@ namespace margelo::nitro::healthkit {
59
58
  std::optional<Quantity> duration SWIFT_PRIVATE;
60
59
  std::optional<std::chrono::system_clock::time_point> startDate SWIFT_PRIVATE;
61
60
  std::optional<std::chrono::system_clock::time_point> endDate SWIFT_PRIVATE;
62
- std::vector<std::shared_ptr<HybridSourceProxySpec>> sources SWIFT_PRIVATE;
61
+ std::vector<Source> sources SWIFT_PRIVATE;
63
62
 
64
63
  public:
65
64
  QueryStatisticsResponse() = default;
66
- explicit QueryStatisticsResponse(std::optional<Quantity> averageQuantity, std::optional<Quantity> maximumQuantity, std::optional<Quantity> minimumQuantity, std::optional<Quantity> sumQuantity, std::optional<Quantity> mostRecentQuantity, std::optional<QuantityDateInterval> mostRecentQuantityDateInterval, std::optional<Quantity> duration, std::optional<std::chrono::system_clock::time_point> startDate, std::optional<std::chrono::system_clock::time_point> endDate, std::vector<std::shared_ptr<HybridSourceProxySpec>> sources): averageQuantity(averageQuantity), maximumQuantity(maximumQuantity), minimumQuantity(minimumQuantity), sumQuantity(sumQuantity), mostRecentQuantity(mostRecentQuantity), mostRecentQuantityDateInterval(mostRecentQuantityDateInterval), duration(duration), startDate(startDate), endDate(endDate), sources(sources) {}
65
+ explicit QueryStatisticsResponse(std::optional<Quantity> averageQuantity, std::optional<Quantity> maximumQuantity, std::optional<Quantity> minimumQuantity, std::optional<Quantity> sumQuantity, std::optional<Quantity> mostRecentQuantity, std::optional<QuantityDateInterval> mostRecentQuantityDateInterval, std::optional<Quantity> duration, std::optional<std::chrono::system_clock::time_point> startDate, std::optional<std::chrono::system_clock::time_point> endDate, std::vector<Source> sources): averageQuantity(averageQuantity), maximumQuantity(maximumQuantity), minimumQuantity(minimumQuantity), sumQuantity(sumQuantity), mostRecentQuantity(mostRecentQuantity), mostRecentQuantityDateInterval(mostRecentQuantityDateInterval), duration(duration), startDate(startDate), endDate(endDate), sources(sources) {}
67
66
 
68
67
  public:
69
68
  friend bool operator==(const QueryStatisticsResponse& lhs, const QueryStatisticsResponse& rhs) = default;
@@ -88,7 +87,7 @@ namespace margelo::nitro {
88
87
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
89
88
  JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
90
89
  JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
91
- JSIConverter<std::vector<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sources")))
90
+ JSIConverter<std::vector<margelo::nitro::healthkit::Source>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sources")))
92
91
  );
93
92
  }
94
93
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryStatisticsResponse& arg) {
@@ -102,7 +101,7 @@ namespace margelo::nitro {
102
101
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.duration));
103
102
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.startDate));
104
103
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.endDate));
105
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "sources"), JSIConverter<std::vector<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>>::toJSI(runtime, arg.sources));
104
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "sources"), JSIConverter<std::vector<margelo::nitro::healthkit::Source>>::toJSI(runtime, arg.sources));
106
105
  return obj;
107
106
  }
108
107
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -122,7 +121,7 @@ namespace margelo::nitro {
122
121
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
123
122
  if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
124
123
  if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
125
- if (!JSIConverter<std::vector<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sources")))) return false;
124
+ if (!JSIConverter<std::vector<margelo::nitro::healthkit::Source>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sources")))) return false;
126
125
  return true;
127
126
  }
128
127
  };
@@ -28,15 +28,14 @@
28
28
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
29
  #endif
30
30
 
31
- // Forward declaration of `HybridSourceProxySpec` to properly resolve imports.
32
- namespace margelo::nitro::healthkit { class HybridSourceProxySpec; }
31
+ // Forward declaration of `Source` to properly resolve imports.
32
+ namespace margelo::nitro::healthkit { struct Source; }
33
33
  // Forward declaration of `Quantity` to properly resolve imports.
34
34
  namespace margelo::nitro::healthkit { struct Quantity; }
35
35
  // Forward declaration of `QuantityDateInterval` to properly resolve imports.
36
36
  namespace margelo::nitro::healthkit { struct QuantityDateInterval; }
37
37
 
38
- #include <memory>
39
- #include "HybridSourceProxySpec.hpp"
38
+ #include "Source.hpp"
40
39
  #include <chrono>
41
40
  #include <optional>
42
41
  #include "Quantity.hpp"
@@ -49,7 +48,7 @@ namespace margelo::nitro::healthkit {
49
48
  */
50
49
  struct QueryStatisticsResponseFromSingleSource final {
51
50
  public:
52
- std::shared_ptr<HybridSourceProxySpec> source SWIFT_PRIVATE;
51
+ Source source SWIFT_PRIVATE;
53
52
  std::optional<std::chrono::system_clock::time_point> startDate SWIFT_PRIVATE;
54
53
  std::optional<std::chrono::system_clock::time_point> endDate SWIFT_PRIVATE;
55
54
  std::optional<Quantity> duration SWIFT_PRIVATE;
@@ -62,7 +61,7 @@ namespace margelo::nitro::healthkit {
62
61
 
63
62
  public:
64
63
  QueryStatisticsResponseFromSingleSource() = default;
65
- explicit QueryStatisticsResponseFromSingleSource(std::shared_ptr<HybridSourceProxySpec> source, std::optional<std::chrono::system_clock::time_point> startDate, std::optional<std::chrono::system_clock::time_point> endDate, std::optional<Quantity> duration, std::optional<Quantity> averageQuantity, std::optional<Quantity> maximumQuantity, std::optional<Quantity> minimumQuantity, std::optional<Quantity> sumQuantity, std::optional<Quantity> mostRecentQuantity, std::optional<QuantityDateInterval> mostRecentQuantityDateInterval): source(source), startDate(startDate), endDate(endDate), duration(duration), averageQuantity(averageQuantity), maximumQuantity(maximumQuantity), minimumQuantity(minimumQuantity), sumQuantity(sumQuantity), mostRecentQuantity(mostRecentQuantity), mostRecentQuantityDateInterval(mostRecentQuantityDateInterval) {}
64
+ explicit QueryStatisticsResponseFromSingleSource(Source source, std::optional<std::chrono::system_clock::time_point> startDate, std::optional<std::chrono::system_clock::time_point> endDate, std::optional<Quantity> duration, std::optional<Quantity> averageQuantity, std::optional<Quantity> maximumQuantity, std::optional<Quantity> minimumQuantity, std::optional<Quantity> sumQuantity, std::optional<Quantity> mostRecentQuantity, std::optional<QuantityDateInterval> mostRecentQuantityDateInterval): source(source), startDate(startDate), endDate(endDate), duration(duration), averageQuantity(averageQuantity), maximumQuantity(maximumQuantity), minimumQuantity(minimumQuantity), sumQuantity(sumQuantity), mostRecentQuantity(mostRecentQuantity), mostRecentQuantityDateInterval(mostRecentQuantityDateInterval) {}
66
65
 
67
66
  public:
68
67
  friend bool operator==(const QueryStatisticsResponseFromSingleSource& lhs, const QueryStatisticsResponseFromSingleSource& rhs) = default;
@@ -78,7 +77,7 @@ namespace margelo::nitro {
78
77
  static inline margelo::nitro::healthkit::QueryStatisticsResponseFromSingleSource fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
79
78
  jsi::Object obj = arg.asObject(runtime);
80
79
  return margelo::nitro::healthkit::QueryStatisticsResponseFromSingleSource(
81
- JSIConverter<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source"))),
80
+ JSIConverter<margelo::nitro::healthkit::Source>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source"))),
82
81
  JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
83
82
  JSIConverter<std::optional<std::chrono::system_clock::time_point>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
84
83
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
@@ -92,7 +91,7 @@ namespace margelo::nitro {
92
91
  }
93
92
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::QueryStatisticsResponseFromSingleSource& arg) {
94
93
  jsi::Object obj(runtime);
95
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "source"), JSIConverter<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>::toJSI(runtime, arg.source));
94
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "source"), JSIConverter<margelo::nitro::healthkit::Source>::toJSI(runtime, arg.source));
96
95
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.startDate));
97
96
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::optional<std::chrono::system_clock::time_point>>::toJSI(runtime, arg.endDate));
98
97
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.duration));
@@ -112,7 +111,7 @@ namespace margelo::nitro {
112
111
  if (!nitro::isPlainObject(runtime, obj)) {
113
112
  return false;
114
113
  }
115
- if (!JSIConverter<std::shared_ptr<margelo::nitro::healthkit::HybridSourceProxySpec>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source")))) return false;
114
+ if (!JSIConverter<margelo::nitro::healthkit::Source>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "source")))) return false;
116
115
  if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
117
116
  if (!JSIConverter<std::optional<std::chrono::system_clock::time_point>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
118
117
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;