Fix: Clear Intent Data #1646
Conversation
Dependency Review✅ No vulnerabilities found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent stale deep-link return data from being re-processed in demo return-to-app flows, and updates developer-facing documentation to instruct clearing Intent.data after handling results. It also updates the documented Google Pay dependency version and adds a build-requirements section to DEPENDENCIES.md.
Changes:
- Clear
Activity.intent.datain Shopper Insights demo fragments after return-to-app handling. - Update
README.mdexamples/instructions to clearintent.datato avoid stale results. - Add “Build Requirements (Merchant-Facing)” to
DEPENDENCIES.mdand bump documentedplay-services-walletto19.5.0.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| README.md | Updates examples/instructions to clear intent.data after receiving results. |
| DEPENDENCIES.md | Adds build requirements section and updates the documented Google Pay dependency version. |
| Demo/src/main/java/com/braintreepayments/demo/ShopperInsightsFragmentV2.kt | Clears intent data on resume to avoid stale return-to-app processing in the demo flow. |
| Demo/src/main/java/com/braintreepayments/demo/ShopperInsightsFragment.kt | Clears intent data on resume to avoid stale return-to-app processing in the demo flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Anastasiia Noguier <anoguier@paypal.com>
|
Is the dependency work related to clearing intent data? |
No, this is just something i wanted to add to this PR, since it is a small change, and we decided to add build dependencies to out |
|
Ah ok. I feel like the dependency changes should be in their own PR. I know that it's a small change, but having work lumped in that's unrelated to the ticket and PR title it's connected to makes it harder or impossible to track down why certain changes were made |
well, we are not changing the dependencies in this PR, more so we are updating the doc so that the dependencies that were already changed are updated in the markdown! But I see your point and can remove it from this PR :) |
| After you've received a result, clear out the `intent.data` by setting it to null. | ||
|
|
||
| ```kotlin | ||
| intent.data = null | ||
| requireActivity().intent.data = null | ||
| ``` |
|
|
||
| private fun handlePayPalReturnToApp() { | ||
| if (this::paypalStartedPendingRequest.isInitialized) { | ||
| val pendingRequest = paypalStartedPendingRequest |
There was a problem hiding this comment.
Do we need this extra property here or we were worried about the value of paypalStartedPendingRequest changing?
|
|
||
| private fun handleVenmoReturnToApp() { | ||
| if (this::venmoStartedPendingRequest.isInitialized) { | ||
| val pendingRequest = venmoStartedPendingRequest |
There was a problem hiding this comment.
|
|
||
| private fun handlePayPalReturnToApp() { | ||
| if (this::paypalStartedPendingRequest.isInitialized) { | ||
| val pendingRequest = paypalStartedPendingRequest |
There was a problem hiding this comment.
There was a problem hiding this comment.
great question, I was actually just trying to match the pattern we already have in the PayPalFragment, since I changed the var from lateinit to nullable we do not need the isInitialized check anymore. We only worry about pendingRequest state now.
saralvasquez
left a comment
There was a problem hiding this comment.
Looks pretty good! Just one suggestion and I'm also curious about Matt's question about the extra property
Summary of changes
READMEAI Usage
Which AI Agent Was Used?
How was AI used?
NA
Estimated AI Code Contribution
Checklist
Authors