From ba011b04fd08c32a7aff6664793987c3b786784a Mon Sep 17 00:00:00 2001 From: Nick Hallstrom Date: Tue, 20 Feb 2024 11:50:51 -0700 Subject: [PATCH] Support Expo 50 --- .../intercom-react-native/build/withIntercomAndroid.js | 10 +++++----- .../intercom-react-native/src/withIntercomAndroid.ts | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/intercom-react-native/build/withIntercomAndroid.js b/packages/intercom-react-native/build/withIntercomAndroid.js index 7308ce86..62102cbb 100644 --- a/packages/intercom-react-native/build/withIntercomAndroid.js +++ b/packages/intercom-react-native/build/withIntercomAndroid.js @@ -207,17 +207,17 @@ const modifyMainApplication = ({ contents, apiKey, appId, packageName, }) => { if (!packageName) { throw new Error("Android package not found"); } - const importLine = `import com.intercom.reactnative.IntercomModule;`; + const importLine = `import com.intercom.reactnative.IntercomModule`; if (!contents.includes(importLine)) { - const packageImport = `package ${packageName};`; + const packageImport = `package ${packageName}`; // Add the import line to the top of the file // Replace the first line with the intercom import contents = contents.replace(`${packageImport}`, `${packageImport}\n${importLine}`); } - const initLine = `IntercomModule.initialize(this, "${apiKey}", "${appId}");`; + const initLine = `IntercomModule.initialize(this, "${apiKey}", "${appId}")`; if (!contents.includes(initLine)) { - const soLoaderLine = `SoLoader.init(this, /* native exopackage */ false);`; - // Replace the line SoLoader.init(this, /* native exopackage */ false); with regex + const soLoaderLine = `SoLoader.init(this, false)`; + // Replace the line SoLoader.init(this, false) with regex contents = contents.replace(`${soLoaderLine}`, `${soLoaderLine}\n\t\t${initLine}\n`); } return contents; diff --git a/packages/intercom-react-native/src/withIntercomAndroid.ts b/packages/intercom-react-native/src/withIntercomAndroid.ts index a7f579ac..3be98249 100644 --- a/packages/intercom-react-native/src/withIntercomAndroid.ts +++ b/packages/intercom-react-native/src/withIntercomAndroid.ts @@ -285,9 +285,9 @@ const modifyMainApplication = ({ throw new Error("Android package not found"); } - const importLine = `import com.intercom.reactnative.IntercomModule;`; + const importLine = `import com.intercom.reactnative.IntercomModule`; if (!contents.includes(importLine)) { - const packageImport = `package ${packageName};`; + const packageImport = `package ${packageName}`; // Add the import line to the top of the file // Replace the first line with the intercom import contents = contents.replace( @@ -296,11 +296,11 @@ const modifyMainApplication = ({ ); } - const initLine = `IntercomModule.initialize(this, "${apiKey}", "${appId}");`; + const initLine = `IntercomModule.initialize(this, "${apiKey}", "${appId}")`; if (!contents.includes(initLine)) { - const soLoaderLine = `SoLoader.init(this, /* native exopackage */ false);`; - // Replace the line SoLoader.init(this, /* native exopackage */ false); with regex + const soLoaderLine = `SoLoader.init(this, false)`; + // Replace the line SoLoader.init(this, false) with regex contents = contents.replace( `${soLoaderLine}`, `${soLoaderLine}\n\t\t${initLine}\n`