Skip to content

Commit c30c529

Browse files
authored
Merge pull request #298 from epalacio90/add_clinical_description_support
added expo support to `NSHealthClinicalHealthRecordsShareUsageDescription`
2 parents 33715e9 + 838b174 commit c30c529

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

app.plugin.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ const { withEntitlementsPlist, withInfoPlist } = require('@expo/config-plugins')
22

33
const HEALTH_SHARE = 'Allow $(PRODUCT_NAME) to check health info'
44
const HEALTH_UPDATE = 'Allow $(PRODUCT_NAME) to update health info'
5+
const HEALTH_CLINIC_SHARE = 'Allow $(PRODUCT_NAME) to check health clinical info'
56

67
const withHealthKit = (
78
config,
8-
{ healthSharePermission, healthUpdatePermission, isClinicalDataEnabled } = {},
9+
{ healthSharePermission, healthUpdatePermission, isClinicalDataEnabled, healthClinicalDescription } = {},
910
) => {
1011
// Add permissions
1112
config = withInfoPlist(config, (config) => {
@@ -17,6 +18,12 @@ const withHealthKit = (
1718
healthUpdatePermission ||
1819
config.modResults.NSHealthUpdateUsageDescription ||
1920
HEALTH_UPDATE
21+
isClinicalDataEnabled ?
22+
config.modResults.NSHealthClinicalHealthRecordsShareUsageDescription =
23+
healthClinicalDescription ||
24+
config.modResults.NSHealthClinicalHealthRecordsShareUsageDescription ||
25+
HEALTH_CLINIC_SHARE :
26+
null
2027

2128
return config
2229
})

docs/Expo.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ The plugin provides props for extra customization. Every time you change the pro
2727
- `healthSharePermission` (_string_): Sets the iOS `NSHealthShareUsageDescription` permission message to the `Info.plist`. Defaults to `Allow $(PRODUCT_NAME) to check health info`.
2828
- `healthUpdatePermission` (_string_): Sets the iOS `NSHealthUpdateUsageDescription` permission message to the `Info.plist`. Defaults to `Allow $(PRODUCT_NAME) to update health info`.
2929
- `isClinicalDataEnabled` (_boolean_): Adds `health-records` to the `com.apple.developer.healthkit.access` entitlement in the iOS project. Defaults to false.
30+
- `healthClinicalDescription` (_string_): Sets the iOS `NSHealthClinicalHealthRecordsShareUsageDescription` permission message to the `Info.plist`. Defaults to `Allow $(PRODUCT_NAME) to check health info`.
3031

3132
`app.config.js`
3233

@@ -39,7 +40,8 @@ The plugin provides props for extra customization. Every time you change the pro
3940
{
4041
"isClinicalDataEnabled": true,
4142
"healthSharePermission": "Custom health share permission",
42-
"healthUpdatePermission": "Custom health update permission"
43+
"healthUpdatePermission": "Custom health update permission",
44+
"healthClinicalDescription": "Custom health share permission for clinical data"
4345
}
4446
]
4547
]

0 commit comments

Comments
 (0)