@kingstinct/react-native-healthkit 7.0.0 → 7.0.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.
Files changed (2) hide show
  1. package/app.plugin.js +23 -4
  2. package/package.json +1 -1
package/app.plugin.js CHANGED
@@ -40,16 +40,35 @@ const {
40
40
  */
41
41
  const withEntitlementsPlugin = (config, { background }) => withEntitlementsPlist(config, (config) => {
42
42
  config.modResults['com.apple.developer.healthkit'] = true
43
- config.modResults['com.apple.developer.healthkit.background-delivery'] = background !== false
43
+
44
+ // background is enabled by default, but possible to opt-out from
45
+ // (haven't seen any drawbacks from having it enabled)
46
+ if (background !== false) {
47
+ config.modResults['com.apple.developer.healthkit.background-delivery'] = true
48
+ }
49
+
44
50
  return config
45
51
  })
46
52
 
47
53
  /**
48
54
  * @type {ConfigPlugin<InfoPlistConfig>}
49
55
  */
50
- const withInfoPlistPlugin = (config, { NSHealthShareUsageDescription, NSHealthUpdateUsageDescription }) => withInfoPlist(config, (config) => {
51
- config.modResults.NSHealthShareUsageDescription = NSHealthShareUsageDescription || (NSHealthShareUsageDescription === false ? undefined : `${config.name} wants to read your health data`)
52
- config.modResults.NSHealthUpdateUsageDescription = NSHealthUpdateUsageDescription || (NSHealthUpdateUsageDescription === false ? undefined : `${config.name} wants to update your health data`)
56
+ const withInfoPlistPlugin = (config,
57
+ /**
58
+ * @type {{NSHealthShareUsageDescription: string | boolean, NSHealthUpdateUsageDescription: string | boolean}}
59
+ * */
60
+ {
61
+ NSHealthShareUsageDescription,
62
+ NSHealthUpdateUsageDescription,
63
+ }) => withInfoPlist(config, (config) => {
64
+ if (NSHealthShareUsageDescription !== false) {
65
+ config.modResults.NSHealthShareUsageDescription = NSHealthShareUsageDescription ?? `${config.name} wants to read your health data`
66
+ }
67
+
68
+ if (NSHealthUpdateUsageDescription !== false) {
69
+ config.modResults.NSHealthUpdateUsageDescription = NSHealthUpdateUsageDescription ?? `${config.name} wants to update your health data`
70
+ }
71
+
53
72
  return config
54
73
  })
55
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingstinct/react-native-healthkit",
3
- "version": "7.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "React Native bindings for HealthKit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",