Skip to content
This repository was archived by the owner on Mar 16, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/intercom-react-native/build/withIntercomAndroid.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions packages/intercom-react-native/src/withIntercomAndroid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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`
Expand Down