Created
January 5, 2022 13:31
-
-
Save kbrandwijk/98916ba5eb8c281b86f3463a4b72d974 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Object.defineProperty(exports, "__esModule", { value: true }); | |
const configPlugins = require("@expo/config-plugins"); | |
const withAppDelegate = (config) => { //refactor this part? | |
return configPlugins.withAppDelegate(config, async config => { | |
let res = config.modResults | |
// ROLLBAR import | |
if (!res.contents.includes("#import <RollbarReactNative/RollbarReactNative.h>")) { | |
res.contents = res.contents.replace(/#import "AppDelegate.h"/g, `#import "AppDelegate.h"\n#import <RollbarReactNative/RollbarReactNative.h>`); | |
} | |
// ROLLBAR | |
if (!res.contents.includes("RollbarReactNative initWithAccessToken")) { | |
res.contents = res.contents.replace(/self.launchOptions = launchOptions;/g, `self.launchOptions = launchOptions;\n[RollbarReactNative initWithAccessToken:@"${process.env.ROLLBAR_KEY}"];\n`); | |
} | |
return config; | |
}); | |
}; | |
exports.withAppDelegate = withAppDelegate; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment