Skip to content

Commit

Permalink
fix: remove a dep of expo config plugin (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
vonovak authored Aug 14, 2023
1 parent e0ba71b commit b3e5d6a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions plugin/src/withThemeControl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { addImports } from '@expo/config-plugins/build/android/codeMod';
import { Paths } from '@expo/config-plugins/build/ios';
import { mergeContents } from '@expo/config-plugins/build/utils/generateCode';
import {
ConfigPlugin,
Expand Down Expand Up @@ -103,22 +102,23 @@ const withIosPlugin: ThemeConfigPlugin = (config, options) => {
return withDangerousMod(config, [
'ios',
async (config) => {
const delegatePath = getAppDelegateFilePath(
const rctAppDelegatePath = getAppDelegateFilePath(
config.modRequest.projectRoot,
'RCTAppDelegate.@(m|mm)',
);
const contents = Paths.getFileInfo(delegatePath).contents;
const withImport = addAppDelegateImport(contents).contents;
const withImport = addAppDelegateImport(
readFileSync(rctAppDelegatePath, 'utf8'),
).contents;
const withThemeRecovered = addThemeRecovery(withImport, options).contents;
await writeFile(delegatePath, withThemeRecovered);
await writeFile(rctAppDelegatePath, withThemeRecovered);

const podspecPath = getAppDelegateFilePath(
const appDelegatePodspecPath = getAppDelegateFilePath(
config.modRequest.projectRoot,
'React-RCTAppDelegate.podspec',
);
const podspecContent = readFileSync(podspecPath, 'utf8');
const podspecContent = readFileSync(appDelegatePodspecPath, 'utf8');
const withHeaderSearchPath = addHeaderSearchPath(podspecContent).contents;
await writeFile(podspecPath, withHeaderSearchPath);
await writeFile(appDelegatePodspecPath, withHeaderSearchPath);
return config;
},
]);
Expand Down

0 comments on commit b3e5d6a

Please sign in to comment.