Skip to content

Conversation

@saperi22
Copy link
Contributor

@saperi22 saperi22 commented Aug 5, 2025

Summary of changes

  • Address issue reported here
  • Introduce PopupBridgeWebViewClient that merchants can implement to extend WebViewClient functionality.

Checklist

  • Added a changelog entry

Authors

List GitHub usernames for everyone who contributed to this pull request.

@saperi22 saperi22 marked this pull request as ready for review August 5, 2025 22:10
@saperi22 saperi22 requested a review from a team as a code owner August 5, 2025 22:10
import android.webkit.WebViewClient
import com.braintreepayments.api.internal.isVenmoInstalled

open class PopupBridgeWebViewClient : WebViewClient() {

Choose a reason for hiding this comment

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

Perhaps, it is possible to make this class as a wrapper that receives library user WebViewClient implementation as a delegate?

class PopupBridgeWebViewClient(
    private val delegate: WebViewClient? = null
) : WebViewClient() {

    override fun onPageFinished(view: WebView?, url: String?) {
        super.onPageFinished(view, url)
        setVenmoInstalled(view, view?.context?.isVenmoInstalled() == true)
        delegate?.onPageFinished(view, url)
    }

    // same for other methods
}

I know it is painful to override all the calls with delegate calls inside, but this approach doesn't limit library users to inheriting strictly from PopupBridgeWebViewClient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seviraristocrat Thanks for reporting the bug and suggesting the solution!

@saperi22 saperi22 changed the title Subclass WebViewClient to provide custom web view client implementation Wrap WebViewClient to provide custom web view client implementation Aug 11, 2025
@saperi22 saperi22 merged commit b96a600 into main Aug 12, 2025
4 checks passed
@saperi22 saperi22 deleted the provide-ability-for-merchant-to-override-webviewclient branch August 12, 2025 23:26
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.

5 participants