react-native-iap 14.3.2-rc.3 โ 14.3.2-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withIAP.d.ts","sourceRoot":"","sources":["../../../../plugin/src/withIAP.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AA0BtD,eAAO,MAAM,wBAAwB,GAAI,QAAQ,MAAM,KAAG,MAWzD,CAAC;;AAiGF,wBAAmE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-iap",
|
|
3
|
-
"version": "14.3.2-rc.
|
|
3
|
+
"version": "14.3.2-rc.4",
|
|
4
4
|
"description": "React Native In-App Purchases module for iOS and Android using Nitro",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"lint:tsc": "tsc -p tsconfig.json --noEmit --skipLibCheck",
|
|
56
56
|
"lint:ci": "yarn lint:tsc && yarn lint:eslint && yarn lint:prettier",
|
|
57
57
|
"prepare": "npx tsx scripts/check-nitro-versions.ts && bob build && yarn nitrogen && yarn build:plugin",
|
|
58
|
-
"nitrogen": "
|
|
59
|
-
"specs": "
|
|
58
|
+
"nitrogen": "nitrogen",
|
|
59
|
+
"specs": "nitrogen --logLevel=\"debug\"",
|
|
60
60
|
"test": "jest --coverage",
|
|
61
61
|
"test:library": "jest --coverage",
|
|
62
62
|
"test:example": "yarn workspace rn-iap-example test --coverage",
|
|
@@ -106,12 +106,12 @@
|
|
|
106
106
|
"husky": "^8.0.3",
|
|
107
107
|
"jest": "^30.1.1",
|
|
108
108
|
"lint-staged": "^15.2.0",
|
|
109
|
-
"
|
|
109
|
+
"nitrogen": "^0.29.4",
|
|
110
110
|
"prettier": "^3.3.3",
|
|
111
111
|
"react": "19.1.0",
|
|
112
112
|
"react-native": "0.81.1",
|
|
113
113
|
"react-native-builder-bob": "^0.38.4",
|
|
114
|
-
"react-native-nitro-modules": "^0.29.
|
|
114
|
+
"react-native-nitro-modules": "^0.29.4",
|
|
115
115
|
"react-test-renderer": "^19.1.1",
|
|
116
116
|
"typescript": "^5.9.2"
|
|
117
117
|
},
|
package/plugin/build/withIAP.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.modifyProjectBuildGradle = void 0;
|
|
7
4
|
const config_plugins_1 = require("expo/config-plugins");
|
|
8
|
-
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
5
|
const pkg = require('../../package.json');
|
|
11
6
|
// Global flag to prevent duplicate logs
|
|
12
7
|
let hasLoggedPluginExecution = false;
|
|
@@ -88,71 +83,9 @@ const withIapAndroid = (config) => {
|
|
|
88
83
|
});
|
|
89
84
|
return config;
|
|
90
85
|
};
|
|
91
|
-
// iOS: Patch Podfile to ensure RCT-Folly is built with FOLLY_NO_CONFIG=1
|
|
92
|
-
const withIapIOS = (config) => {
|
|
93
|
-
return (0, config_plugins_1.withDangerousMod)(config, [
|
|
94
|
-
'ios',
|
|
95
|
-
async (config) => {
|
|
96
|
-
const { platformProjectRoot } = config.modRequest;
|
|
97
|
-
const podfilePath = path_1.default.join(platformProjectRoot, 'Podfile');
|
|
98
|
-
if (!fs_1.default.existsSync(podfilePath)) {
|
|
99
|
-
return config;
|
|
100
|
-
}
|
|
101
|
-
let content = fs_1.default.readFileSync(podfilePath, 'utf8');
|
|
102
|
-
// 1) Ensure CocoaPods CDN source is present at the top
|
|
103
|
-
const cdnLine = `source 'https://cdn.cocoapods.org/'`;
|
|
104
|
-
if (!content.includes(cdnLine)) {
|
|
105
|
-
content = `${cdnLine}\n\n${content}`;
|
|
106
|
-
if (!hasLoggedPluginExecution) {
|
|
107
|
-
console.log('๐ฆ react-native-iap: Added CocoaPods CDN source to Podfile');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
// 2) Remove any lingering local OpenIAP pod injection
|
|
111
|
-
const localPodRegex = /^\s*pod\s+'openiap'\s*,\s*:path\s*=>\s*['"][^'"]+['"][^\n]*$/gm;
|
|
112
|
-
if (localPodRegex.test(content)) {
|
|
113
|
-
content = content.replace(localPodRegex, '').replace(/\n{3,}/g, '\n\n');
|
|
114
|
-
if (!hasLoggedPluginExecution) {
|
|
115
|
-
console.log('๐งน react-native-iap: Removed local OpenIAP pod from Podfile');
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
// 3) Ensure RCT-Folly has FOLLY_NO_CONFIG=1 to avoid missing folly-config.h
|
|
119
|
-
if (!content.includes('FOLLY_NO_CONFIG=1')) {
|
|
120
|
-
const inject = `\n # react-native-iap: Ensure FOLLY_NO_CONFIG for all Pods targets (avoids missing folly-config.h)\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n settings = config.build_settings\n defs = settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)']\n unless defs.any? { |d| d.to_s.include?('FOLLY_NO_CONFIG') }\n defs << 'FOLLY_NO_CONFIG=1'\n end\n settings['GCC_PREPROCESSOR_DEFINITIONS'] = defs\n end\n end\n`;
|
|
121
|
-
const rnPostInstallCall = /(react_native_post_install\([\s\S]*?\)\n)/m;
|
|
122
|
-
if (rnPostInstallCall.test(content)) {
|
|
123
|
-
content = content.replace(rnPostInstallCall, `$1${inject}`);
|
|
124
|
-
if (!hasLoggedPluginExecution) {
|
|
125
|
-
console.log('๐ ๏ธ react-native-iap: Injected Folly fix after react_native_post_install()');
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
const postInstallStart = /post_install\s+do\s*\|installer\|/m;
|
|
130
|
-
if (postInstallStart.test(content)) {
|
|
131
|
-
const idx = content.lastIndexOf('\nend\n');
|
|
132
|
-
if (idx !== -1) {
|
|
133
|
-
content = content.slice(0, idx) + inject + content.slice(idx);
|
|
134
|
-
if (!hasLoggedPluginExecution) {
|
|
135
|
-
console.log('๐ ๏ธ react-native-iap: Injected Folly fix near end of post_install');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
config_plugins_1.WarningAggregator.addWarningIOS('react-native-iap', 'Unable to place Folly fix; no end found.');
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
config_plugins_1.WarningAggregator.addWarningIOS('react-native-iap', 'No post_install found to inject Folly fix.');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
fs_1.default.writeFileSync(podfilePath, content);
|
|
148
|
-
return config;
|
|
149
|
-
},
|
|
150
|
-
]);
|
|
151
|
-
};
|
|
152
86
|
const withIAP = (config, _props) => {
|
|
153
87
|
try {
|
|
154
|
-
|
|
155
|
-
result = withIapIOS(result);
|
|
88
|
+
const result = withIapAndroid(config);
|
|
156
89
|
// Set flag after first execution to prevent duplicate logs
|
|
157
90
|
hasLoggedPluginExecution = true;
|
|
158
91
|
return result;
|
package/plugin/src/withIAP.ts
CHANGED
|
@@ -3,11 +3,8 @@ import {
|
|
|
3
3
|
WarningAggregator,
|
|
4
4
|
withAndroidManifest,
|
|
5
5
|
withAppBuildGradle,
|
|
6
|
-
withDangerousMod,
|
|
7
6
|
} from 'expo/config-plugins';
|
|
8
|
-
import type {
|
|
9
|
-
import fs from 'fs';
|
|
10
|
-
import path from 'path';
|
|
7
|
+
import type {ConfigPlugin} from 'expo/config-plugins';
|
|
11
8
|
|
|
12
9
|
const pkg = require('../../package.json');
|
|
13
10
|
|
|
@@ -99,7 +96,7 @@ const withIapAndroid: ConfigPlugin = (config) => {
|
|
|
99
96
|
}
|
|
100
97
|
|
|
101
98
|
const permissions = manifest.manifest['uses-permission'];
|
|
102
|
-
const billingPerm = {
|
|
99
|
+
const billingPerm = {$: {'android:name': 'com.android.vending.BILLING'}};
|
|
103
100
|
|
|
104
101
|
const alreadyExists = permissions.some(
|
|
105
102
|
(p) => p.$['android:name'] === 'com.android.vending.BILLING',
|
|
@@ -125,83 +122,9 @@ const withIapAndroid: ConfigPlugin = (config) => {
|
|
|
125
122
|
return config;
|
|
126
123
|
};
|
|
127
124
|
|
|
128
|
-
// iOS: Patch Podfile to ensure RCT-Folly is built with FOLLY_NO_CONFIG=1
|
|
129
|
-
const withIapIOS: ConfigPlugin = (config) => {
|
|
130
|
-
return withDangerousMod(config, [
|
|
131
|
-
'ios',
|
|
132
|
-
async (config) => {
|
|
133
|
-
const { platformProjectRoot } = config.modRequest;
|
|
134
|
-
const podfilePath = path.join(platformProjectRoot, 'Podfile');
|
|
135
|
-
|
|
136
|
-
if (!fs.existsSync(podfilePath)) {
|
|
137
|
-
return config;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
let content = fs.readFileSync(podfilePath, 'utf8');
|
|
141
|
-
|
|
142
|
-
// 1) Ensure CocoaPods CDN source is present at the top
|
|
143
|
-
const cdnLine = `source 'https://cdn.cocoapods.org/'`;
|
|
144
|
-
if (!content.includes(cdnLine)) {
|
|
145
|
-
content = `${cdnLine}\n\n${content}`;
|
|
146
|
-
if (!hasLoggedPluginExecution) {
|
|
147
|
-
console.log('๐ฆ react-native-iap: Added CocoaPods CDN source to Podfile');
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// 2) Remove any lingering local OpenIAP pod injection
|
|
152
|
-
const localPodRegex =
|
|
153
|
-
/^\s*pod\s+'openiap'\s*,\s*:path\s*=>\s*['"][^'"]+['"][^\n]*$/gm;
|
|
154
|
-
if (localPodRegex.test(content)) {
|
|
155
|
-
content = content.replace(localPodRegex, '').replace(/\n{3,}/g, '\n\n');
|
|
156
|
-
if (!hasLoggedPluginExecution) {
|
|
157
|
-
console.log('๐งน react-native-iap: Removed local OpenIAP pod from Podfile');
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// 3) Ensure RCT-Folly has FOLLY_NO_CONFIG=1 to avoid missing folly-config.h
|
|
162
|
-
if (!content.includes('FOLLY_NO_CONFIG=1')) {
|
|
163
|
-
const inject = `\n # react-native-iap: Ensure FOLLY_NO_CONFIG for all Pods targets (avoids missing folly-config.h)\n installer.pods_project.targets.each do |target|\n target.build_configurations.each do |config|\n settings = config.build_settings\n defs = settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)']\n unless defs.any? { |d| d.to_s.include?('FOLLY_NO_CONFIG') }\n defs << 'FOLLY_NO_CONFIG=1'\n end\n settings['GCC_PREPROCESSOR_DEFINITIONS'] = defs\n end\n end\n`;
|
|
164
|
-
|
|
165
|
-
const rnPostInstallCall = /(react_native_post_install\([\s\S]*?\)\n)/m;
|
|
166
|
-
if (rnPostInstallCall.test(content)) {
|
|
167
|
-
content = content.replace(rnPostInstallCall, `$1${inject}`);
|
|
168
|
-
if (!hasLoggedPluginExecution) {
|
|
169
|
-
console.log('๐ ๏ธ react-native-iap: Injected Folly fix after react_native_post_install()');
|
|
170
|
-
}
|
|
171
|
-
} else {
|
|
172
|
-
const postInstallStart = /post_install\s+do\s*\|installer\|/m;
|
|
173
|
-
if (postInstallStart.test(content)) {
|
|
174
|
-
const idx = content.lastIndexOf('\nend\n');
|
|
175
|
-
if (idx !== -1) {
|
|
176
|
-
content = content.slice(0, idx) + inject + content.slice(idx);
|
|
177
|
-
if (!hasLoggedPluginExecution) {
|
|
178
|
-
console.log('๐ ๏ธ react-native-iap: Injected Folly fix near end of post_install');
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
WarningAggregator.addWarningIOS(
|
|
182
|
-
'react-native-iap',
|
|
183
|
-
'Unable to place Folly fix; no end found.',
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
} else {
|
|
187
|
-
WarningAggregator.addWarningIOS(
|
|
188
|
-
'react-native-iap',
|
|
189
|
-
'No post_install found to inject Folly fix.',
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
fs.writeFileSync(podfilePath, content);
|
|
196
|
-
return config;
|
|
197
|
-
},
|
|
198
|
-
]);
|
|
199
|
-
};
|
|
200
|
-
|
|
201
125
|
const withIAP: ConfigPlugin = (config, _props) => {
|
|
202
126
|
try {
|
|
203
|
-
|
|
204
|
-
result = withIapIOS(result);
|
|
127
|
+
const result = withIapAndroid(config);
|
|
205
128
|
// Set flag after first execution to prevent duplicate logs
|
|
206
129
|
hasLoggedPluginExecution = true;
|
|
207
130
|
return result;
|