Skip to content

[Android] Move url encoding to protocol#324

Merged
kiftio merged 1 commit into
mainfrom
06-24-move_url_encoding_to_protocol
Jun 25, 2026
Merged

[Android] Move url encoding to protocol#324
kiftio merged 1 commit into
mainfrom
06-24-move_url_encoding_to_protocol

Conversation

@kiftio

@kiftio kiftio commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

Moves the responsibility of constructing ECP-compliant checkout URLs into EmbeddedCheckoutProtocol itself via a new url() function. Previously, UriExtensions.kt in the Android platform contained its own implementation of appendEcpParams that manually managed ec_version and ec_delegate query parameters. That logic has been replaced with a call to EmbeddedCheckoutProtocol.url(), which now owns the canonical URL-building behaviour for the protocol.

The new EmbeddedCheckoutProtocol.url() function:

  • Appends ec_version set to SPEC_VERSION
  • Optionally appends ec_delegate as a comma-separated list of delegation strings
  • Strips any caller-supplied ec_version or ec_delegate values before appending its own, making it idempotent
  • Preserves all other existing query parameters
  • Falls back to returning the original URL if parsing fails or the URI is opaque

The appendEcpParams() extension in the Android platform is simplified to delegate directly to EmbeddedCheckoutProtocol.url(), and the hardcoded specVersion parameter is removed from all call sites.

How to test

  1. Run the UriExtensionsTest suite on Android and confirm all existing appendEcpParams tests pass.
  2. Run the EmbeddedCheckoutProtocolTest suite and confirm the new url() tests pass, covering:
    • ec_version is appended and ec_delegate is omitted when no delegations are provided
    • Multiple delegations are joined with a comma in ec_delegate
    • Existing non-protocol query parameters are preserved
    • Caller-supplied ec_version/ec_delegate values are replaced (idempotency)
    • An empty delegations list removes any pre-existing ec_delegate value

Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated platforms/swift/CHANGELOG.md
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Android version?
  • I have bumped checkoutKitAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated platforms/android/CHANGELOG.md
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

@kiftio kiftio mentioned this pull request Jun 24, 2026
11 tasks

kiftio commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@kiftio kiftio marked this pull request as ready for review June 24, 2026 11:30
@kiftio kiftio requested a review from a team as a code owner June 24, 2026 11:30
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

React Native — Coverage Report

Lines Statements Branches Functions
Coverage: 92%
91.66% (319/348) 87.86% (181/206) 100% (82/82)

@kiftio kiftio force-pushed the 06-22-split_android_checkout_protocol branch from 691cd9c to aba9849 Compare June 24, 2026 11:30
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from ef79018 to 53488b2 Compare June 24, 2026 11:30
@github-actions

Copy link
Copy Markdown

Package Size

Platform Artifact Base Head Delta
Android release AAR 167.9 KiB 167.2 KiB -674 B

Measured from the PR base SHA and PR head SHA. This comment reports package artifact sizes only; it is not a final app binary-size report.

@kiftio kiftio changed the title Move url encoding to protocol [Android] Move url encoding to protocol Jun 24, 2026
*/
public fun url(
url: String,
delegations: List<String> = emptyList(),

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.

Just a heads up that I've changed this to an options struct argument for Swift in this PR to add support for colorScheme and auth. It scales better than adding new arguments for every param added to the spec

@markmur markmur left a comment

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.

Looks good. Might be worth incorporating the changes from this PR before shipping but I'll leave it up to you

@kiftio kiftio force-pushed the 06-22-split_android_checkout_protocol branch from aba9849 to a55876b Compare June 24, 2026 14:23
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from 53488b2 to 9ae6451 Compare June 24, 2026 14:23
@kiftio kiftio changed the base branch from 06-22-split_android_checkout_protocol to graphite-base/324 June 24, 2026 14:58
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from 9ae6451 to bdd4542 Compare June 24, 2026 14:58
@kiftio kiftio changed the base branch from graphite-base/324 to 06-24-publish_packages_independently June 24, 2026 14:58
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from bdd4542 to afb8ce9 Compare June 24, 2026 15:29
@kiftio kiftio force-pushed the 06-24-publish_packages_independently branch from 45bb9fb to 05c4f31 Compare June 24, 2026 15:29
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from afb8ce9 to d98a9b4 Compare June 24, 2026 15:57
@kiftio kiftio force-pushed the 06-24-publish_packages_independently branch from 05c4f31 to 9716dc8 Compare June 24, 2026 15:57
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from d98a9b4 to f4914e7 Compare June 25, 2026 08:39
@kiftio kiftio force-pushed the 06-24-publish_packages_independently branch from 9716dc8 to a75817c Compare June 25, 2026 08:39

kiftio commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jun 25, 9:26 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 25, 9:46 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 25, 10:06 AM UTC: @kiftio merged this pull request with Graphite.

@kiftio kiftio changed the base branch from 06-24-publish_packages_independently to graphite-base/324 June 25, 2026 09:27
@kiftio kiftio force-pushed the graphite-base/324 branch from a75817c to f79b4c3 Compare June 25, 2026 09:42
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from f4914e7 to 7bc20e2 Compare June 25, 2026 09:42
@kiftio kiftio changed the base branch from graphite-base/324 to 06-24-publish_packages_independently June 25, 2026 09:42
@kiftio kiftio mentioned this pull request Jun 25, 2026
13 tasks
@kiftio kiftio changed the base branch from 06-24-publish_packages_independently to graphite-base/324 June 25, 2026 09:44
@kiftio kiftio changed the base branch from graphite-base/324 to main June 25, 2026 09:44
@kiftio kiftio force-pushed the 06-24-move_url_encoding_to_protocol branch from 7bc20e2 to 9cfe4ae Compare June 25, 2026 09:45
@kiftio kiftio merged commit 210cf54 into main Jun 25, 2026
33 checks passed
@kiftio kiftio deleted the 06-24-move_url_encoding_to_protocol branch June 25, 2026 10:06
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.

3 participants