From b9da393a71326d80a6fb22d6214620b6819308f1 Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Mon, 4 Nov 2024 09:24:17 +0000 Subject: [PATCH] Add consumer proguard rules to prevent minification --- CHANGELOG.md | 5 +++++ .../@shopify/checkout-sheet-kit/android/build.gradle | 9 ++++++++- .../checkout-sheet-kit/android/proguard-rules.pro | 12 ++++++++++++ modules/@shopify/checkout-sheet-kit/package.json | 2 +- sample/android/app/build.gradle | 9 ++------- sample/ios/Podfile.lock | 4 ++-- 6 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 modules/@shopify/checkout-sheet-kit/android/proguard-rules.pro diff --git a/CHANGELOG.md b/CHANGELOG.md index 9540708..049db0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 3.1.2 - November 4, 2024 + +- Add `consumerProguardRules` build.gradle option to prevent minification of + classes in release builds. + ## 3.1.1 - November 1, 2024 - Logs invalid JSON for lifecycle events diff --git a/modules/@shopify/checkout-sheet-kit/android/build.gradle b/modules/@shopify/checkout-sheet-kit/android/build.gradle index b866a2e..29b2aa9 100644 --- a/modules/@shopify/checkout-sheet-kit/android/build.gradle +++ b/modules/@shopify/checkout-sheet-kit/android/build.gradle @@ -60,9 +60,16 @@ android { } buildTypes { - release { + debug { minifyEnabled false } + + release { + minifyEnabled true + + // Rules in consumerProguardFiles are automatically included in the ProGuard configuration of any application that uses the library + consumerProguardFiles 'proguard-rules.pro' + } } lintOptions { diff --git a/modules/@shopify/checkout-sheet-kit/android/proguard-rules.pro b/modules/@shopify/checkout-sheet-kit/android/proguard-rules.pro new file mode 100644 index 0000000..9e869ad --- /dev/null +++ b/modules/@shopify/checkout-sheet-kit/android/proguard-rules.pro @@ -0,0 +1,12 @@ +# Keep the ObjectMapper and its methods +-keep class com.fasterxml.jackson.databind.ObjectMapper { *; } + +# Keep Checkout Sheet Kit classes +-keep class com.shopify.checkoutsheetkit.lifecycleevents.CheckoutCompletedEvent { *; } +-keep class com.shopify.checkoutsheetkit.pixelevents.PixelEvent { *; } +-keep class com.shopify.checkoutsheetkit.CheckoutException { *; } +-keep class com.shopify.checkoutsheetkit.CheckoutExpiredException { *; } +-keep class com.shopify.checkoutsheetkit.ClientException { *; } +-keep class com.shopify.checkoutsheetkit.HttpException { *; } +-keep class com.shopify.checkoutsheetkit.ConfigurationException { *; } +-keep class com.shopify.checkoutsheetkit.CheckoutSheetKitException { *; } diff --git a/modules/@shopify/checkout-sheet-kit/package.json b/modules/@shopify/checkout-sheet-kit/package.json index 4362c29..7b1e493 100644 --- a/modules/@shopify/checkout-sheet-kit/package.json +++ b/modules/@shopify/checkout-sheet-kit/package.json @@ -1,7 +1,7 @@ { "name": "@shopify/checkout-sheet-kit", "license": "MIT", - "version": "3.1.1", + "version": "3.1.2", "main": "lib/commonjs/index.js", "types": "src/index.ts", "source": "src/index.ts", diff --git a/sample/android/app/build.gradle b/sample/android/app/build.gradle index 8ff103b..4d0ad8e 100644 --- a/sample/android/app/build.gradle +++ b/sample/android/app/build.gradle @@ -53,11 +53,6 @@ react { hermesFlags = ["-O", "-output-source-map"] } -/** - * Set this to true to Run Proguard on Release builds to minify the Java bytecode. - */ -def enableProguardInReleaseBuilds = false - /** * The preferred build flavor of JavaScriptCore (JSC) * @@ -115,8 +110,8 @@ android { } release { signingConfig signingConfigs.release - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + minifyEnabled true + proguardFiles "proguard-rules.pro" } } } diff --git a/sample/ios/Podfile.lock b/sample/ios/Podfile.lock index 8661503..9d2bd3e 100644 --- a/sample/ios/Podfile.lock +++ b/sample/ios/Podfile.lock @@ -1235,7 +1235,7 @@ PODS: - ReactCommon/turbomodule/bridging - ReactCommon/turbomodule/core - Yoga - - RNShopifyCheckoutSheetKit (3.1.0): + - RNShopifyCheckoutSheetKit (3.1.1): - React-Core - ShopifyCheckoutSheetKit (~> 3.1.1) - RNVectorIcons (10.0.3): @@ -1524,7 +1524,7 @@ SPEC CHECKSUMS: RNGestureHandler: 9b113eb9b7a4cbe66e1dbf4d9914281863ee0703 RNReanimated: d534e0114e2c3e7011550a78ecf2d0b431435a60 RNScreens: 23dad53fc9db1da2c93e647ae33fd7ce2bd49d60 - RNShopifyCheckoutSheetKit: 3d854ed7fe1bc96eab4718819ee79d33488066bc + RNShopifyCheckoutSheetKit: 0fb6aa9fe539a331f313d8e009ecb1917fc6c103 RNVectorIcons: 50ea777efffdd991a22e968aa312d75da7ff46c3 ShopifyCheckoutSheetKit: fe309799b18b8d554f28c3f075d6d57d4811c9ab SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d