Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set connected false in endConnection (#2807)
### Summary This PR addresses an issue with the `currentPurchase` status not updating correctly in the library after a successful in-app purchase. The problem occurs because the `purchaseListener` is only connected once when the app is first connected, and not after that. This requires users to repeat the purchase process by killing the app. ### Problem Description After a successful in-app connection, the store purchase completes, but the `currentPurchase` status does not update. This is likely due to the `purchaseListener` being connected based on the `connected` value inside `useEffect`. The `connected` value changes from `false` to `true` only when the app first connects, and not subsequently, preventing proper subscription to the current order status. ### Solution To resolve this, I added code inside the `endConnection` method to set `connected` to `false`. This ensures that every subscription updates correctly by changing `connected` to `true` when accessing the order page and to `false` when accessing `endConnection`. This approach has been tested and works as expected on both iOS and Android. ### Related Issue This issue appears to be related to the following issue: [#2700](#2700). ### Conclusion I hope this PR helps everyone experiencing this issue. Thank you for considering this improvement.
- Loading branch information