From e191d6552d8d881adb80779162927836f3dff860 Mon Sep 17 00:00:00 2001 From: Abdullah Mzaien Date: Sat, 12 Apr 2025 11:49:16 +0300 Subject: [PATCH 1/3] feat: change appDelegate intercom import to support swift --- src/expo-plugins/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/expo-plugins/index.ts b/src/expo-plugins/index.ts index 979293df..6f10f506 100644 --- a/src/expo-plugins/index.ts +++ b/src/expo-plugins/index.ts @@ -92,7 +92,8 @@ const withIntercomAndroid: ConfigPlugin = ( const appDelegate: ConfigPlugin = (_config, props) => withAppDelegate(_config, (config) => { let stringContents = config.modResults.contents; - stringContents = addObjcImports(stringContents, ['']); + const swiftAppDelegate = config.modResults.contents.includes('import React'); + stringContents = swiftAppDelegate ? addImports(stringContents, ['Intercom'],false) : addObjcImports(stringContents, ['']); // Remove previous code stringContents = stringContents.replace( From c81325edf8fb8378c5b41afd85ad4eda68174271 Mon Sep 17 00:00:00 2001 From: Abdullah Mzaien Date: Sat, 12 Apr 2025 11:56:56 +0300 Subject: [PATCH 2/3] chore: more accurate way of detecting swift app delegate --- src/expo-plugins/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/expo-plugins/index.ts b/src/expo-plugins/index.ts index 6f10f506..0904f2df 100644 --- a/src/expo-plugins/index.ts +++ b/src/expo-plugins/index.ts @@ -6,6 +6,7 @@ import { withAppDelegate, withInfoPlist, withMainApplication, + IOSConfig, } from '@expo/config-plugins'; import { @@ -92,7 +93,7 @@ const withIntercomAndroid: ConfigPlugin = ( const appDelegate: ConfigPlugin = (_config, props) => withAppDelegate(_config, (config) => { let stringContents = config.modResults.contents; - const swiftAppDelegate = config.modResults.contents.includes('import React'); + const swiftAppDelegate = IOSConfig.Paths.getAppDelegate(config.modRequest.projectRoot).language==="swift" stringContents = swiftAppDelegate ? addImports(stringContents, ['Intercom'],false) : addObjcImports(stringContents, ['']); // Remove previous code From b989fe9ef072d4fe61d00a115d7b0177743709f4 Mon Sep 17 00:00:00 2001 From: Abdullah Mzaien Date: Sat, 12 Apr 2025 13:27:31 +0300 Subject: [PATCH 3/3] chore: lint --- src/expo-plugins/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/expo-plugins/index.ts b/src/expo-plugins/index.ts index 0904f2df..13616ecc 100644 --- a/src/expo-plugins/index.ts +++ b/src/expo-plugins/index.ts @@ -93,8 +93,12 @@ const withIntercomAndroid: ConfigPlugin = ( const appDelegate: ConfigPlugin = (_config, props) => withAppDelegate(_config, (config) => { let stringContents = config.modResults.contents; - const swiftAppDelegate = IOSConfig.Paths.getAppDelegate(config.modRequest.projectRoot).language==="swift" - stringContents = swiftAppDelegate ? addImports(stringContents, ['Intercom'],false) : addObjcImports(stringContents, ['']); + const swiftAppDelegate = + IOSConfig.Paths.getAppDelegate(config.modRequest.projectRoot).language === + 'swift'; + stringContents = swiftAppDelegate + ? addImports(stringContents, ['Intercom'], false) + : addObjcImports(stringContents, ['']); // Remove previous code stringContents = stringContents.replace(