react-native-keys
Version:
🔐 Make protected .ENVs variables
30 lines (29 loc) • 1.64 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.withIosSchemeRunScript = exports.withIosAppDelegateDependency = void 0;
const config_plugins_1 = require("@expo/config-plugins");
function applyImplementation(appDelegate, find, add, replace) {
if (!appDelegate.includes(add)) {
if (replace)
return appDelegate.replace(find, add);
else
return appDelegate.replace(find, `${find}\n${add}`);
}
return appDelegate;
}
const withIosAppDelegateDependency = (config) => {
return (0, config_plugins_1.withAppDelegate)(config, (config) => {
config.modResults.contents = applyImplementation(config.modResults.contents, `#import "AppDelegate.h"`, `#import <CodePush/CodePush.h>`);
config.modResults.contents = applyImplementation(config.modResults.contents, `return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`, `return [CodePush bundleURL];`, true);
return config;
});
};
exports.withIosAppDelegateDependency = withIosAppDelegateDependency;
const withIosSchemeRunScript = (config) => {
return (0, config_plugins_1.withXcodeProject)(config, (config) => {
config.modResults.contents = applyImplementation(config.modResults.contents, `#import "AppDelegate.h"`, `#import <CodePush/CodePush.h>`);
config.modResults.contents = applyImplementation(config.modResults.contents, `return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];`, `return [CodePush bundleURL];`, true);
return config;
});
};
exports.withIosSchemeRunScript = withIosSchemeRunScript;
;