Skip to content

v6: GooglePay - Launch GooglePay#2610

Draft
ozgur00 wants to merge 2 commits intochore/factory-applicationfrom
chore/google-pay-event
Draft

v6: GooglePay - Launch GooglePay#2610
ozgur00 wants to merge 2 commits intochore/factory-applicationfrom
chore/google-pay-event

Conversation

@ozgur00
Copy link
Copy Markdown
Contributor

@ozgur00 ozgur00 commented Feb 25, 2026

Description

Add a googlePayEvent composable for launching google pay.

Checklist

  • Changes are tested manually

Ticket Number

COSDK-936

@ozgur00 ozgur00 requested a review from a team as a code owner February 25, 2026 12:32
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ozgur00, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request integrates Google Pay functionality into the application's UI layer by introducing a dedicated Composable function. This new component streamlines the process of initiating Google Pay transactions and processing their outcomes, enhancing the user experience for payment flows.

Highlights

  • New Google Pay Composable: Introduced the googlePayEvent composable function to manage the lifecycle of launching Google Pay and handling its results using rememberLauncherForActivityResult and LaunchedEffect.
  • Google Pay View Event Definition: Defined a GooglePayViewEvent sealed class with a LaunchGooglePay data class to encapsulate the event for triggering the Google Pay launch.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/GooglePayEvent.kt
    • Added the googlePayEvent composable function.
    • Implemented rememberLauncherForActivityResult to handle Google Pay results.
    • Used LaunchedEffect to observe GooglePayViewEvent flow and launch Google Pay when a LaunchGooglePay event occurs.
  • googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/GooglePayViewEvent.kt
    • Created a new sealed class GooglePayViewEvent.
    • Defined LaunchGooglePay data class within GooglePayViewEvent to hold the Task<PaymentData> for launching Google Pay.
Activity
  • No specific review comments or activity have been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AdyenAutomationBot AdyenAutomationBot added the Chore [PRs only] Indicates any task that does not need to be mentioned in the public release notes label Feb 25, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a composable googlePayEvent to handle launching Google Pay from a Compose UI. The implementation looks good, but I have a suggestion to improve the robustness and performance of the LaunchedEffect within the new composable. My feedback focuses on making the side effect handling more stable and ensuring future changes to event types are caught at compile time.

Comment on lines +32 to +40
LaunchedEffect(viewEventFlow, onPaymentResult) {
viewEventFlow.collect { event ->
when (event) {
is GooglePayViewEvent.LaunchGooglePay -> {
googlePayLauncher.launch(event.task)
}
}
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

I have a couple of suggestions for this LaunchedEffect block:

  1. LaunchedEffect key: The onPaymentResult callback is included as a key. Since lambdas from callers are not guaranteed to be stable, this can cause the effect to be cancelled and restarted on every recomposition. This would lead to re-collecting the viewEventFlow, which can cause issues like missing events. Since onPaymentResult is not used inside the LaunchedEffect block, it should be removed from the keys. The rememberLauncherForActivityResult already handles updating its callback correctly on recompositions.

  2. Non-exhaustive when: The when statement on GooglePayViewEvent is not exhaustive because it's used as a statement. If new event types are added to the GooglePayViewEvent sealed class in the future, the compiler won't enforce handling them, and they will be silently ignored at runtime. To prevent this, you can use when as an expression to enforce compile-time checking for all cases.

Here is a suggestion that applies both changes:

    LaunchedEffect(viewEventFlow) {
        viewEventFlow.collect { event ->
            @Suppress("UNUSED_VARIABLE")
            val exhaustiveWhen = when (event) {
                is GooglePayViewEvent.LaunchGooglePay -> {
                    googlePayLauncher.launch(event.task)
                }
            }
        }
    }

@github-actions
Copy link
Copy Markdown
Contributor

✅ No public API changes

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@araratthehero araratthehero marked this pull request as draft March 20, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Chore [PRs only] Indicates any task that does not need to be mentioned in the public release notes size:tiny

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants