@@ -36,14 +36,20 @@ const {
36
36
*/
37
37
38
38
/**
39
- * @type {ConfigPlugin<{background: BackgroundConfig}> }
40
- */
41
- const withEntitlementsPlugin = ( config , { background } ) => withEntitlementsPlist ( config , ( config ) => {
39
+ * @type {ConfigPlugin<{background: BackgroundConfig}> }
40
+ */
41
+ const withEntitlementsPlugin = (
42
+ config ,
43
+ /**
44
+ * @type {{background: BackgroundConfig} | undefined }
45
+ * */
46
+ props ,
47
+ ) => withEntitlementsPlist ( config , ( config ) => {
42
48
config . modResults [ 'com.apple.developer.healthkit' ] = true
43
49
44
50
// background is enabled by default, but possible to opt-out from
45
51
// (haven't seen any drawbacks from having it enabled)
46
- if ( background !== false ) {
52
+ if ( props ?. background !== false ) {
47
53
config . modResults [ 'com.apple.developer.healthkit.background-delivery' ] = true
48
54
}
49
55
@@ -55,18 +61,15 @@ const withEntitlementsPlugin = (config, { background }) => withEntitlementsPlist
55
61
*/
56
62
const withInfoPlistPlugin = ( config ,
57
63
/**
58
- * @type {{NSHealthShareUsageDescription: string | boolean, NSHealthUpdateUsageDescription: string | boolean} }
64
+ * @type {{NSHealthShareUsageDescription: string | boolean, NSHealthUpdateUsageDescription: string | boolean} | undefined }
59
65
* */
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
+ props ) => withInfoPlist ( config , ( config ) => {
67
+ if ( props ?. NSHealthShareUsageDescription !== false ) {
68
+ config . modResults . NSHealthShareUsageDescription = props . NSHealthShareUsageDescription ?? `${ config . name } wants to read your health data`
66
69
}
67
70
68
- if ( NSHealthUpdateUsageDescription !== false ) {
69
- config . modResults . NSHealthUpdateUsageDescription = NSHealthUpdateUsageDescription ?? `${ config . name } wants to update your health data`
71
+ if ( props ?. NSHealthUpdateUsageDescription !== false ) {
72
+ config . modResults . NSHealthUpdateUsageDescription = props . NSHealthUpdateUsageDescription ?? `${ config . name } wants to update your health data`
70
73
}
71
74
72
75
return config
@@ -77,9 +80,9 @@ const pkg = require('./package.json')
77
80
/**
78
81
* @type {ConfigPlugin<AppPluginConfig> }
79
82
*/
80
- const healthkitAppPlugin = ( config , { NSHealthShareUsageDescription , NSHealthUpdateUsageDescription , background } ) => withPlugins ( config , [
81
- [ withEntitlementsPlugin , { background } ] ,
82
- [ withInfoPlistPlugin , { NSHealthShareUsageDescription , NSHealthUpdateUsageDescription } ] ,
83
+ const healthkitAppPlugin = ( config , props ) => withPlugins ( config , [
84
+ [ withEntitlementsPlugin , props ] ,
85
+ [ withInfoPlistPlugin , props ] ,
83
86
] )
84
87
85
88
/**
0 commit comments