Skip to content
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 null intent crash #430

Merged
merged 6 commits into from
Jan 11, 2022
Merged

Fix null intent crash #430

merged 6 commits into from
Jan 11, 2022

Conversation

beylmk
Copy link
Contributor

@beylmk beylmk commented Jan 6, 2022

Fixes [sc-11657]

Related issues:
#381
community post

BillingClient expects that the Activity passed into launchBillingFlow has a non-null intent. The fix is to detect a null intent and pass a new one in.

I'm unsure whether setting an empty intent could have unwanted side effects...maybe we want to only log here.

@shortcut-integration
Copy link

@@ -222,6 +223,10 @@ class BillingWrapper(
activity: Activity,
params: BillingFlowParams
) {
if (activity.intent == null) {
activity.intent = Intent()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like devs might be setting the intent to null intentionally #381 (comment), so I wonder if this will have unintended consequences for this developer.

Maybe we can ask them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asked!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with "always be shipping" in mind, i've reverted the "fix" and just left the log. we can consider setting to a null intent once we hear back.

seems like a react-native plugin also sets the intent to null, and someone posted a fix: ajith-ab/react-native-receive-sharing-intent#110 (comment)

but i still don't feel confident whether that could lead to unwanted side effects. i thought about if we could set it to Intent() before calling launchBillingFlow, and then set it back to null after (if it was null)? still probably not foolproof though...

@beylmk beylmk force-pushed the null-intent-crash branch from 045ebf8 to cd39770 Compare January 10, 2022 18:38
@beylmk beylmk merged commit ac305e7 into main Jan 11, 2022
@beylmk beylmk deleted the null-intent-crash branch January 11, 2022 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants