-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: add Amazon IAP v3.0.5 handle #2255
base: main
Are you sure you want to change the base?
Fix: add Amazon IAP v3.0.5 handle #2255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this PR, please see my comments and we can get this change in!
// appstore v3.0.4 | ||
listenerHandlerObject = listenerHandlerClass.getMethod("g").invoke(null) | ||
registerListenerOnMainThread = true | ||
} catch (err: NullPointerException) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the error log you provided and my own testing, this should catch a NoSuchMethodException
.
I don't have clear insight into the Amazon IAP source code, but it seems that calling listenerHandlerObject = listenerHandlerClass.getMethod("e").invoke(null)
throws a NPE but calling listenerHandlerObject = listenerHandlerClass.getMethod("g").invoke(null)
throws a NoSuchMethodException
.
Since we are also nesting try-catches here, even though it is not currently used, let's rename the inner err
variable to differ from the outer err
variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review, I don't have experience with kotlin or java, noticed error in logcat while integrating capacitor library
Changed error variable names and exception class in the catch block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! Thanks!
Noting that g()
returns a NoSuchMethodException
instead of NPE is because in Amazon IAP 3.0.5, g()
is an inaccessible private method. In contrast, there are public methods called d()
, e()
, f()
.
a73d6db
to
106ed55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and confirmed on my end with Amazon IAP 3.0.5.
Description
Added Amazon IAP v3.0.5 handle
Details
I'm developing app for business and faced this error while integrating
[email protected]
Error appeared because I also use @revenuecat/[email protected] (versions between 8.0.0 and 9.2.1 use Amazon IAP v3.0.5)
So Amazon IAP v3.0.5 is downloaded and we can't access method at class com.amazon.device.iap.internal.d
line:
OneSignal-Android-SDK/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/core/internal/purchases/impl/TrackAmazonPurchase.kt
Line 83 in c96e91f
Error screenshot:
This method at v3.0.4
This method at v3.0.5
Manual testing
Steps:
docs: https://capacitorjs.com/docs/v6/getting-started/with-ionic
docs:
https://documentation.onesignal.com/docs/ionic-capacitor-cordova-sdk-setup
https://www.revenuecat.com/docs/getting-started/installation/capacitor
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is