Implement restore/sync purchases for Galaxy Store#2955
Conversation
tonidero
left a comment
There was a problem hiding this comment.
Looks great! I think we could simplify by always passing all to the galaxy SDK. Wdyt? other than that ![]()
|
|
||
| internal fun ProductType.toGalaxyProductTypeString(): String? { | ||
| return when (this) { | ||
| ProductType.SUBS -> "subscription" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Should we mark this method as @Throws even though it's not actually enforced in Kotlin?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Switched it to always request all products here: 8508983 👍
Description
Implements the following functions in
GalaxyBillingWrapper:queryAllPurchases()findPurchaseInPurchaseHistory()This unlocks both syncPurchases() and restorePurchases() behavior in the SDK for the Galaxy Store.