Skip to content

Commit

Permalink
added healthClinicalDescription to expo plugin in order to add `NSH…
Browse files Browse the repository at this point in the history
…ealthClinicalHealthRecordsShareUsageDescription` support

modified documentation to reflect it
  • Loading branch information
epalacio90 committed Mar 11, 2023
1 parent 3c4b87d commit 838b174
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ const { withEntitlementsPlist, withInfoPlist } = require('@expo/config-plugins')

const HEALTH_SHARE = 'Allow $(PRODUCT_NAME) to check health info'
const HEALTH_UPDATE = 'Allow $(PRODUCT_NAME) to update health info'
const HEALTH_CLINIC_SHARE = 'Allow $(PRODUCT_NAME) to check health clinical info'

const withHealthKit = (
config,
{ healthSharePermission, healthUpdatePermission, isClinicalDataEnabled } = {},
{ healthSharePermission, healthUpdatePermission, isClinicalDataEnabled, healthClinicalDescription } = {},
) => {
// Add permissions
config = withInfoPlist(config, (config) => {
Expand All @@ -17,6 +18,12 @@ const withHealthKit = (
healthUpdatePermission ||
config.modResults.NSHealthUpdateUsageDescription ||
HEALTH_UPDATE
isClinicalDataEnabled ?
config.modResults.NSHealthClinicalHealthRecordsShareUsageDescription =
healthClinicalDescription ||
config.modResults.NSHealthClinicalHealthRecordsShareUsageDescription ||
HEALTH_CLINIC_SHARE :
null

return config
})
Expand Down
4 changes: 3 additions & 1 deletion docs/Expo.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The plugin provides props for extra customization. Every time you change the pro
- `healthSharePermission` (_string_): Sets the iOS `NSHealthShareUsageDescription` permission message to the `Info.plist`. Defaults to `Allow $(PRODUCT_NAME) to check health info`.
- `healthUpdatePermission` (_string_): Sets the iOS `NSHealthUpdateUsageDescription` permission message to the `Info.plist`. Defaults to `Allow $(PRODUCT_NAME) to update health info`.
- `isClinicalDataEnabled` (_boolean_): Adds `health-records` to the `com.apple.developer.healthkit.access` entitlement in the iOS project. Defaults to false.
- `healthClinicalDescription` (_string_): Sets the iOS `NSHealthClinicalHealthRecordsShareUsageDescription` permission message to the `Info.plist`. Defaults to `Allow $(PRODUCT_NAME) to check health info`.

`app.config.js`

Expand All @@ -39,7 +40,8 @@ The plugin provides props for extra customization. Every time you change the pro
{
"isClinicalDataEnabled": true,
"healthSharePermission": "Custom health share permission",
"healthUpdatePermission": "Custom health update permission"
"healthUpdatePermission": "Custom health update permission",
"healthClinicalDescription": "Custom health share permission for clinical data"
}
]
]
Expand Down

0 comments on commit 838b174

Please sign in to comment.