Commit b4e5fcc
fix(android): delegate fetchProducts type 'all' to native query on Android (#239)
## Summary
- Fixes `fetchProducts({ type: 'all' })` on Android returning
subscriptions as `in-app` with `productStatusAndroid: 'not-found'`.
- Root cause: the react-native-iap Android bridge expanded `all` into
separate in-app and subs queries and merged them with `putIfAbsent`.
Since openiap-google 2.4.x, each per-type query returns a not-found
placeholder row for every requested sku of the other type, so the in-app
placeholder shadowed the real subscription from the subs query.
- Fix: pass the query type through unchanged so the native module
resolves `ProductQueryType.All` itself (all three store flavors —
play/horizon/amazon — already handle it correctly, matching each sku as
in-app first, then subs, then a typed unavailable placeholder). This
also stops the `productTypeBySku` cache from being poisoned with
`in-app` for subscription skus, which previously broke subsequent
`requestPurchase` type hints.
- Removes the now-unused `collectAllQueryProducts` helper and its tests
(one test baked the buggy first-match-wins semantics in as expected
behavior).
- Adds a release-note entry to `packages/docs` documenting the fix as
the react-native-iap 15.5.4 release (assumed-published mode; the
release-tag link goes live once 15.5.4 is deployed).
- Other SDKs (expo-iap, flutter_inapp_purchase, godot-iap, maui-iap,
kmp-iap) already delegate `all` to the native layer and are unaffected.
Closes #238
## Test plan
- [x] `yarn typecheck` passes (react-native-iap)
- [x] `yarn lint` passes (react-native-iap)
- [x] `bunx prettier --check`, `bun run build`, `bun run audit:docs`,
`git diff --check` pass (packages/docs)
- [ ] Android CI build passes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_0154xivm4YeCVS9yxk54bHL6
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Bug Fixes**
* Improved Android `fetchProducts({ type: 'all' })` behavior to fetch
products more consistently and align closer to native handling.
* Preserves the requested SKU order and includes additional fetched
products without dropping unmatched results.
* **Documentation**
* Added a `react-native-iap 15.5.4` release note describing the Android
`fetchProducts({ type: 'all' })` fix and updated the package release
links.
* **Tests**
* Removed Android product-query helper tests that covered the previous
multi-part “all” query behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 8b2c385 commit b4e5fcc
4 files changed
Lines changed: 128 additions & 217 deletions
File tree
- libraries/react-native-iap/android/src
- main/java/com/margelo/nitro/iap
- test/java/com/margelo/nitro/iap
- packages/docs/src/pages/docs/updates
Lines changed: 24 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
436 | 417 | | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
441 | 429 | | |
| 430 | + | |
442 | 431 | | |
443 | 432 | | |
444 | 433 | | |
| |||
Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 0 additions & 140 deletions
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
25 | 29 | | |
26 | 30 | | |
27 | 31 | | |
| |||
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
73 | 177 | | |
74 | 178 | | |
75 | 179 | | |
| |||
0 commit comments