Skip to content

Commit 8e0aad3

Browse files
committed
Fix withAppsFluyerAndroid
1 parent d58aba9 commit 8e0aad3

3 files changed

Lines changed: 17 additions & 27 deletions

File tree

Docs/RN_ExpoInstallation.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,3 @@ Setting `"shouldUsePurchaseConnector": true` will:
123123

124124
* **iOS** – add the `PurchaseConnector` CocoaPod automatically
125125
* **Android** – add `appsflyer.enable_purchase_connector=true` to `gradle.properties`
126-
127-
> **Expo SDK 53 note**
128-
> Due to a known Expo 53 issue, the Android will fail to apply. Manually add
129-
> `appsflyer.enable_purchase_connector=true` to `android/gradle.properties`.

expo/withAppsFlyer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
const withAppsFlyerIos = require('./withAppsFlyerIos');
2-
//const withAppsFlyerAndroid = require('./withAppsFlyerAndroid');
2+
const withAppsFlyerAndroid = require('./withAppsFlyerAndroid');
3+
console.log('[AppsFlyerPlugin] Main plugin loaded');
34

45
module.exports = function withAppsFlyer(config, {
56
shouldUseStrictMode = false,
67
shouldUsePurchaseConnector = false
78
} = {}) {
89
config = withAppsFlyerIos(config, { shouldUseStrictMode, shouldUsePurchaseConnector });
9-
//config = withAppsFlyerAndroid(config, { shouldUsePurchaseConnector });
10+
config = withAppsFlyerAndroid(config, { shouldUsePurchaseConnector });
1011
return config;
1112
};

expo/withAppsFlyerAndroid.js

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
1-
// this is not used currently because of a bug in Expo 53 , please manually add appsflyer.enable_purchase_connector = true to the gradle.properties file in Order to use Purchase Connector feature in Android.
2-
/*
31
const { withGradleProperties } = require('@expo/config-plugins');
42

5-
function withAppsFlyerGradleProperties(config) {
6-
return withGradleProperties(config, (config) => {
7-
const props = config.modResults;
8-
9-
const alreadySet = props.some(p => p.key === 'appsflyer.enable_purchase_connector');
10-
if (!alreadySet) {
11-
props.push({
12-
key: 'appsflyer.enable_purchase_connector',
13-
value: 'true',
14-
});
3+
function addPurchaseConnectorFlag(config) {
4+
return withGradleProperties(config, (cfg) => {
5+
const props = cfg.modResults ?? [];
6+
const exists = props.some((p) => p.key === 'appsflyer.enable_purchase_connector');
7+
if (!exists) {
8+
props.push({ type: 'property', key: 'appsflyer.enable_purchase_connector', value: 'true' });
9+
} else {
10+
console.log('[AppsFlyerPlugin] Flag already present, no changes made');
1511
}
16-
17-
return config;
12+
return cfg;
1813
});
1914
}
2015

21-
module.exports = function withAppsFlyerAndroid(config, {
22-
shouldUsePurchaseConnector = false
23-
} = {}) {
16+
module.exports = function withAppsFlyerAndroid(config, { shouldUsePurchaseConnector = false } = {}) {
2417
if (shouldUsePurchaseConnector) {
25-
config = withAppsFlyerGradleProperties(config);
18+
config = addPurchaseConnectorFlag(config);
19+
} else {
20+
console.log('[AppsFlyerPlugin] Purchase Connector disabled, skipping gradle property injection');
2621
}
27-
2822
return config;
29-
};
30-
*/
23+
};

0 commit comments

Comments
 (0)