Skip to content

Commit 23101ff

Browse files
committed
Gradle modification
1 parent a05ec6b commit 23101ff

1 file changed

Lines changed: 18 additions & 19 deletions

File tree

expo/withAppsFlyerAndroid.js

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1+
const { withGradleProperties } = require('@expo/config-plugins');
2+
13
module.exports = function withAppsFlyerAndroid(config, {
2-
shouldUsePurchaseConnector = false
3-
} = {}) {
4-
5-
if (shouldUsePurchaseConnector) {
6-
if (!config.android) {
7-
config.android = {};
8-
}
9-
10-
if (!config.android.gradleProperties) {
11-
config.android.gradleProperties = [];
12-
}
13-
14-
// Prevent duplicates
15-
const existingKeys = config.android.gradleProperties.map(p => p.key);
16-
if (!existingKeys.includes('appsflyer.enable_purchase_connector')) {
17-
config.android.gradleProperties.push({
4+
shouldUsePurchaseConnector = false
5+
} = {}) {
6+
7+
if (shouldUsePurchaseConnector) {
8+
config = withGradleProperties(config, config => {
9+
const props = config.modResults;
10+
11+
const alreadySet = props.some(p => p.key === 'appsflyer.enable_purchase_connector');
12+
if (!alreadySet) {
13+
props.push({
1814
key: 'appsflyer.enable_purchase_connector',
1915
value: 'true',
2016
});
2117
}
22-
}
23-
18+
19+
return config;
20+
});
21+
}
22+
2423
return config;
25-
};
24+
};

0 commit comments

Comments
 (0)