Skip to content

Commit

Permalink
fix expo plugin for internal purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMoch committed Nov 27, 2024
1 parent 1c06c15 commit 9bb9753
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/react-native-video/src/expo-plugins/writeToPodfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ export const writeToPodfile = (
const podfilePath = path.join(projectRoot, 'ios', 'Podfile');
const podfileContent = fs.readFileSync(podfilePath, 'utf8');

if (podfileContent.includes(`$${key} =`)) {
// This is for internal purposes only. We are removing the ENV checks from the Podfile.
// If this conflicts with your project's setup, please let report it to us.
const regex =
/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;

const podfileContentWithoutEnv = `{${podfileContent}}`.replace(regex, '');

if (podfileContentWithoutEnv.includes(`$${key} =`)) {
console.warn(
`RNV - Podfile already contains a definition for "$${key}". Skipping...`,
);
return;
}

if (testApp) {
console.log('RNV - Writing to Test App Podfile');
mergeTestAppPodfile(podfileContent, podfilePath, key, value);
} else {
console.log('RNV - Writing to Expo Podfile');
mergeExpoPodfile(podfileContent, podfilePath, key, value);
}
};
Expand Down

0 comments on commit 9bb9753

Please sign in to comment.