Skip to content

Commit 9bb9753

Browse files
committed
fix expo plugin for internal purposes
1 parent 1c06c15 commit 9bb9753

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/react-native-video/src/expo-plugins/writeToPodfile.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,25 @@ export const writeToPodfile = (
1111
const podfilePath = path.join(projectRoot, 'ios', 'Podfile');
1212
const podfileContent = fs.readFileSync(podfilePath, 'utf8');
1313

14-
if (podfileContent.includes(`$${key} =`)) {
14+
// This is for internal purposes only. We are removing the ENV checks from the Podfile.
15+
// If this conflicts with your project's setup, please let report it to us.
16+
const regex =
17+
/if ENV\['RNV_SAMPLE_ENABLE_ADS'\]\s*\n\s*\$RNVideoUseGoogleIMA\s*=\s*(true|false)\s*\nend\n*|if ENV\['RNV_SAMPLE_VIDEO_CACHING'\]\s*\n\s*\$RNVideoUseVideoCaching\s*=\s*(true|false)\s*\nend\n*/g;
18+
19+
const podfileContentWithoutEnv = `{${podfileContent}}`.replace(regex, '');
20+
21+
if (podfileContentWithoutEnv.includes(`$${key} =`)) {
1522
console.warn(
1623
`RNV - Podfile already contains a definition for "$${key}". Skipping...`,
1724
);
1825
return;
1926
}
2027

2128
if (testApp) {
29+
console.log('RNV - Writing to Test App Podfile');
2230
mergeTestAppPodfile(podfileContent, podfilePath, key, value);
2331
} else {
32+
console.log('RNV - Writing to Expo Podfile');
2433
mergeExpoPodfile(podfileContent, podfilePath, key, value);
2534
}
2635
};

0 commit comments

Comments
 (0)