Skip to content

Implement restore/sync purchases for Galaxy Store#2955

Merged
fire-at-will merged 8 commits into
samsung-devfrom
restore-purchases
Dec 19, 2025
Merged

Implement restore/sync purchases for Galaxy Store#2955
fire-at-will merged 8 commits into
samsung-devfrom
restore-purchases

Conversation

@fire-at-will

Copy link
Copy Markdown
Contributor

Description

Implements the following functions in GalaxyBillingWrapper:

  • queryAllPurchases()
  • findPurchaseInPurchaseHistory()

This unlocks both syncPurchases() and restorePurchases() behavior in the SDK for the Galaxy Store.

@fire-at-will fire-at-will requested a review from a team as a code owner December 18, 2025 21:07
@fire-at-will fire-at-will added the pr:feat A new feature label Dec 18, 2025

@tonidero tonidero 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 great! I think we could simplify by always passing all to the galaxy SDK. Wdyt? other than that :shipit:


internal fun ProductType.toGalaxyProductTypeString(): String? {
return when (this) {
ProductType.SUBS -> "subscription"

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 to check but is there a constant in the galaxy SDK we could reference instead of hardcoding the string value? This is fine if not.

@fire-at-will fire-at-will Dec 19, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It looks like they do! I've switched us over to use them here df25d3a

): StoreTransaction {
val productType = this.type.createRevenueCatProductTypeFromSamsungIAPTypeString()

// throws IllegalArgumentException if the string is an invalid format

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.

Should we mark this method as @Throws even though it's not actually enforced in Kotlin?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think so, even though the compiler doesn't enforce it, it could still help a developer realize that it throws. Annotated it with @Throws in a9a920b

onReceivePurchaseHistory(emptyList())
serialRequestExecutor.executeSerially { finish ->
getOwnedListHandler.getOwnedList(
productType = null, // Passing null here queries all product types

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.

Hmm so, this will always be null... Would it make sense to simplify and remove this parameter entirely, and just always query for all products?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that could help simplify things! I'll make the change, and if we ever need to query for a specific product type later, we can add it back in.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Switched it to always request all products here: 8508983 👍

@fire-at-will fire-at-will merged commit d2fa23f into samsung-dev Dec 19, 2025
0 of 2 checks passed
@fire-at-will fire-at-will deleted the restore-purchases branch December 19, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:feat A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants