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

Expose iOS PurchaseParamsBuilder API to KMP #1028

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

fire-at-will
Copy link
Contributor

@fire-at-will fire-at-will commented Jan 24, 2025

Exposing RCPurchaseParamsBuilder

For some reason, the RCPurchaseParamsBuilder class from the native iOS SDK isn't exposed by PHC's API to the KMP SDK by default. We're able to force it to be available by adding a public noOP function in an extension at the PHC level.
This PR exposes the RCPurchaseParamsBuilder class from the native iOS SDK through the PHC API by adding a public noOP function to the builder class.

Other Approaches Considered

  • We can’t expose RCPurchaseParamsBuilder as a typealias since swift typealiases aren’t available in obj-c
  • We could build the PurchaseParams through helper functions contained in PHC for each combination for params that we want to use, but this will add many unnecessary functions containing logic over time
  • I tried copy/pasted the RCPurchaseParams and RCPurchaseParamsBuilder directly classes into PHC, and when the classes are located there, RCPurchaseParamsBuilder is accessible without any additional extension shenanigans, but this still doesn't explain why the original RCPurchaseParamsBuilder class is unavailable.

@fire-at-will fire-at-will marked this pull request as ready for review January 24, 2025 20:23
Copy link
Member

@JayShortway JayShortway left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines +15 to +18
// PurchaseParams.Builder isn't exposed as a part of the PHC's public API to KMP by default.
// We can expose it by adding this function to the PurchaseParams.Builder class. This function is intentionally a no-op
// and shouldn't be called anywhere but also shouldn't be removed without ensuring that the PurchaseParams.Builder
// class is exposed to KMP in some other way.
Copy link
Member

Choose a reason for hiding this comment

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

👌

@fire-at-will fire-at-will merged commit 179dc3a into main Jan 27, 2025
9 checks passed
@fire-at-will fire-at-will deleted the expose-purchaseparamsbuilder-api branch January 27, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants