From c9da803254fba0ee09f9bf76bab41e7ef8eda1cb Mon Sep 17 00:00:00 2001 From: Arpan Lahiri Date: Thu, 8 Feb 2024 19:14:02 +0530 Subject: [PATCH] Kotlin java semicolon crash --- build/android/mainApplicationDependency.js | 8 ++++---- .../android/mainApplicationDependency.js.map | 2 +- src/android/mainApplicationDependency.ts | 20 ++++++++++--------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/build/android/mainApplicationDependency.js b/build/android/mainApplicationDependency.js index e03f341..6d95323 100644 --- a/build/android/mainApplicationDependency.js +++ b/build/android/mainApplicationDependency.js @@ -12,14 +12,14 @@ const withAndroidMainApplicationDependency = (config) => { // Import the plugin class. const hostWrapperClass = "import expo.modules.ReactNativeHostWrapper"; const codePushClass = "import com.microsoft.codepush.react.CodePush"; - // Expo 50 uses Kotlin and does not require the ; - if (mainApplicationProps.modResults.contents.includes(hostWrapperClass)) { - mainApplicationProps.modResults.contents = (0, addBelowAnchorIfNotFound_1.addBelowAnchorIfNotFound)(mainApplicationProps.modResults.contents, hostWrapperClass, codePushClass); - } // Expo 49 uses Java and requires the ; if (mainApplicationProps.modResults.contents.includes(`${hostWrapperClass};`)) { mainApplicationProps.modResults.contents = (0, addBelowAnchorIfNotFound_1.addBelowAnchorIfNotFound)(mainApplicationProps.modResults.contents, `${hostWrapperClass};`, `${codePushClass};`); } + // Expo 50 uses Kotlin and does not require the ; + else if (mainApplicationProps.modResults.contents.includes(hostWrapperClass)) { + mainApplicationProps.modResults.contents = (0, addBelowAnchorIfNotFound_1.addBelowAnchorIfNotFound)(mainApplicationProps.modResults.contents, hostWrapperClass, codePushClass); + } /** * Override the getJSBundleFile method in order to let * the CodePush runtime determine where to get the JS diff --git a/build/android/mainApplicationDependency.js.map b/build/android/mainApplicationDependency.js.map index ea2504c..77a4285 100644 --- a/build/android/mainApplicationDependency.js.map +++ b/build/android/mainApplicationDependency.js.map @@ -1 +1 @@ -{"version":3,"file":"mainApplicationDependency.js","sourceRoot":"","sources":["../../src/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AyB;QACzB,MAAM,wBAAwB,GAAG,oCAAoC,CAAC;QACtE,IACE,oBAAoB,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAC/C,wBAAwB,CACzB,EACD;YACA,oBAAoB,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAA,mDAAwB,EACjE,oBAAoB,CAAC,UAAU,CAAC,QAAQ,EACxC,wBAAwB,EACxB,wBAAwB,CACzB,CAAC;YAEF,OAAO,oBAAoB,CAAC;SAC7B;QAED,iFAAiF;QACjF,MAAM,qBAAqB,GAAG,6BAA6B,CAAC;QAC5D,IACE,oBAAoB,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC,EACxE;YACA,oBAAoB,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAA,mDAAwB,EACjE,oBAAoB,CAAC,UAAU,CAAC,QAAQ,EACxC,qBAAqB,EACrB,wBAAwB,CACzB,CAAC;YAEF,OAAO,oBAAoB,CAAC;SAC7B;QAED,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA1FW,QAAA,oCAAoC,wCA0F/C"} \ No newline at end of file +{"version":3,"file":"mainApplicationDependency.js","sourceRoot":"","sources":["../../src/android/mainApplicationDependency.ts"],"names":[],"mappings":";;;AAAA,wDAAwE;AAGxE,gFAA6E;AAE7E;;;GAGG;AACI,MAAM,oCAAoC,GAE7C,CAAC,MAAM,EAAE,EAAE;IACb,OAAO,IAAA,oCAAmB,EAAC,MAAM,EAAE,CAAC,oBAAoB,EAAE,EAAE;QAC1D,2BAA2B;QAC3B,MAAM,gBAAgB,GAAG,4CAA4C,CAAC;QACtE,MAAM,aAAa,GAAG,8CAA8C,CAAC;QAErE,uCAAuC;QACvC,IACE,oBAAoB,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,gBAAgB,GAAG,CAAC,EACzE;YACA,oBAAoB,CAAC,UAAU,C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AAC,EACxE;YACA,oBAAoB,CAAC,UAAU,CAAC,QAAQ,GAAG,IAAA,mDAAwB,EACjE,oBAAoB,CAAC,UAAU,CAAC,QAAQ,EACxC,qBAAqB,EACrB,wBAAwB,CACzB,CAAC;YAEF,OAAO,oBAAoB,CAAC;SAC7B;QAED,MAAM,IAAI,KAAK,CACb,2EAA2E,CAC5E,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA5FW,QAAA,oCAAoC,wCA4F/C"} \ No newline at end of file diff --git a/src/android/mainApplicationDependency.ts b/src/android/mainApplicationDependency.ts index 6acb7de..ebdbe4f 100644 --- a/src/android/mainApplicationDependency.ts +++ b/src/android/mainApplicationDependency.ts @@ -15,15 +15,6 @@ export const withAndroidMainApplicationDependency: ConfigPlugin< const hostWrapperClass = "import expo.modules.ReactNativeHostWrapper"; const codePushClass = "import com.microsoft.codepush.react.CodePush"; - // Expo 50 uses Kotlin and does not require the ; - if (mainApplicationProps.modResults.contents.includes(hostWrapperClass)) { - mainApplicationProps.modResults.contents = addBelowAnchorIfNotFound( - mainApplicationProps.modResults.contents, - hostWrapperClass, - codePushClass - ); - } - // Expo 49 uses Java and requires the ; if ( mainApplicationProps.modResults.contents.includes(`${hostWrapperClass};`) @@ -35,6 +26,17 @@ export const withAndroidMainApplicationDependency: ConfigPlugin< ); } + // Expo 50 uses Kotlin and does not require the ; + else if (mainApplicationProps.modResults.contents.includes(hostWrapperClass)) { + mainApplicationProps.modResults.contents = addBelowAnchorIfNotFound( + mainApplicationProps.modResults.contents, + hostWrapperClass, + codePushClass + ); + } + + + /** * Override the getJSBundleFile method in order to let * the CodePush runtime determine where to get the JS