Repository navigation
fix(plugin): run without options and keep an existing Google Pay manifest entry - #56
Merged
Merged
Conversation
…fest entry Listing "@gmisoftware/react-native-pay" without an options object crashed expo prebuild, because the plugin destructured undefined props. The entrypoint now defaults them, and the sub-plugins keep a strict contract. When enableGooglePay was omitted, the plugin removed com.google.android.gms.wallet.api.enabled even if another plugin had added it. It now adds the entry for true, removes it for false and leaves the manifest alone when the option is omitted. withApplePay normalizes merchant IDs once and warns about IDs that do not start with "merchant.". Closes #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23
Summary
"plugins": ["@gmisoftware/react-native-pay"]no longer crashesexpo prebuildwithCannot read properties of undefined (reading 'enableGooglePay'). The entrypoint defaults theundefinedprops Expo passes to{}, andwithGooglePayandwithApplePaykeep a strictConfigPlugin<ReactNativePayPluginProps>contract.enableGooglePayhas three states:trueaddscom.google.android.gms.wallet.api.enabled,falseremoves it, and omitted (ornull) leaves the Android manifest alone, so an entry added by another plugin (Stripe, for example) survives.withApplePaynormalizesmerchantIdentifierto one list, and prebuild warns (WarningAggregator.addWarningIOS) about IDs that don't start withmerchant.. They are still added.setup/expo-plugin.md,compatibility.md),type.tsJSDoc,CHANGELOG.mdand SPEC-003 describe the new contract.Test plan
cd package && bun run typecheckcd package && bun run lintcd package && bun run test:ci(10 suites, 146 tests). The new tests fail onmainwith theTypeErrorfrom the issue.cd package && bun run check:docsbun run docs:buildapp.plugin.js(bun run typescript) and called it the way Expo does: no options andmerchantIdentifier: []register no mods;enableGooglePay: falseregisters the manifest mod;com.example.appprints the warning../gradlew :gmisoftware_react-native-pay:testDebugUnitTest(not run: no Kotlin changes)xcodebuild test ... -scheme NitroPay-Unit-Tests(not run: no Swift changes)cd example && bunx expo run:ios/run:android(not run: build-time plugin change only.src/plugin/__tests__/index.integration.test.tsruns the plugin through Expo'swithPluginsand mod pipeline on a real manifest object instead. The example passes both options, so its output is unchanged.)Risk
enableGooglePayand relied on the plugin removing the Google Pay meta-data now keep it. SetenableGooglePay: falseto keep removing it, then runnpx expo prebuild --clean. Configs that set the option, including the example, behave as before.merchantIdentifier: []or['']no longer registers the two iOS mods. They wrote nothing before, so the generated files are the same.Notes
nullforenableGooglePayis treated as omitted, as the issue specifies ("remove it only when it is explicitlyfalse").merchant.prefix warns instead of failing, so prebuilds that work today keep working.Need help on this PR? Tag
@codesmith-botwith what you need.