Conversation
| import com.revenuecat.purchases.models.StoreTransaction | ||
|
|
||
| private typealias PurchaseCompletedFunction = (purchase: StoreTransaction, customerInfo: CustomerInfo) -> Unit | ||
| private typealias ProductChangeCompletedFunction = (purchase: StoreTransaction?, customerInfo: CustomerInfo) -> Unit |
There was a problem hiding this comment.
I believe we lose some info from not having the typealias name (for example, these 2 typealiases are almost identical). But I think we earn in making sure devs know exactly what the API looks like, so I think it's a good change overall
|
|
||
| /** | ||
| * Make a purchase. | ||
| * Make a purchase upgrading from a previous sku. |
There was a problem hiding this comment.
I changed these since otherwise these 2 methods with the same name had almost the same documentation.
| @Deprecated("Purchase replaced with StoreTransaction and PurchaserInfo with CustomerInfo") | ||
| private typealias DeprecatedProductChangeCompletedFunction = (purchase: Purchase?, purchaserInfo: PurchaserInfo) -> Unit | ||
| private typealias ErrorFunction = (error: PurchasesError) -> Unit | ||
| private typealias PurchaseErrorFunction = (error: PurchasesError, userCancelled: Boolean) -> Unit |
There was a problem hiding this comment.
I left these 2 here since we don't generate docs from these deprecated functions
| onError: PurchaseErrorFunction = ON_PURCHASE_ERROR_STUB, | ||
| onSuccess: PurchaseCompletedFunction | ||
| onError: (error: PurchasesError, userCancelled: Boolean) -> Unit = ON_PURCHASE_ERROR_STUB, | ||
| onSuccess: (purchase: StoreTransaction, customerInfo: CustomerInfo) -> Unit |
There was a problem hiding this comment.
Oh shoot I just realized we have an inconsistency on the order of the functions. Here we have onError first then onSuccess, which is on purpose so folks can omit the last parameter and do:
Purchases.purchaseProductWith(.....) { purchase, customerInfo ->
But other functions have the onError in last place 😮💨
Nothing to worry about now but wanted to mention it
There was a problem hiding this comment.
Ohh good catch! Yeah... I guess we might want to make it consistent on the next major... But probably we shouldn't change it here.
Description
https://revenuecats.atlassian.net/browse/CSDK-300
This removes all private typealiases from the public api so Dokka can generate the docs appropriately.
This is an example of how it looks:
