anjlab / android-inapp-billing-v3

A lightweight implementation of Android In-app Billing Version 3
Other
2.19k stars 535 forks source link

Fix user canceled #517

Open max-critcrew opened 2 years ago

max-critcrew commented 2 years ago

See: https://github.com/anjlab/android-inapp-billing-v3/issues/516

fixed various issues that caused the payment flow not call the listeners (e.g. when the user canceled or item was unavailable, etc.)

Some of the additionally triggered listeners like developer error might trigger double now, but better double then not receiving the errors. If any library author could double check that'd be awesome.

serggl commented 2 years ago

@max-critcrew can you please clean up all the extra changes in the PR? (anything except BillingProcessor changes?) Also do ming explaining what error codes will 'double'?

max-critcrew commented 2 years ago

@serggl Without the extra changes, it wouldn't compile on https://jitpack.io/ - so these are necessary in order to make it work for testing. Do you know any other way how I can make it work?

Absolutely agree about the BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED that was unnecessary, I removed that.

About possible double issues: I am not entirely sure which of the errors that I am catching here and calling reportBillingError for are also catched otherwise. I'd expect that the creators of the plugin also tested some of these and made some of these trigger. I know for sure that the DEVELOPER_ERROR can trigger sometimes. Therefore, I am not certain which errors now might trigger twice since. Since it's not entirely clear which errors come up here and which ones were already catched and reported to the listeners, I chose to better propagate errors like DEVELOPER_ERROR twice than not at all.

serggl commented 2 years ago

@max-critcrew this project is published via maven central, so these extra changes are not required. Also the licence key in the sample project does not really needs to be changed to compile, right? The ideal PR should only contain changes related the bug fix, nothing extra. Happy to merge this when you'll clean up this a little