-
Notifications
You must be signed in to change notification settings - Fork 53
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
Remove private typealiases to fix generated documentation #554
Conversation
@@ -10,20 +10,12 @@ import com.revenuecat.purchases.interfaces.ReceiveOfferingsCallback | |||
import com.revenuecat.purchases.models.StoreProduct | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -407,7 +407,7 @@ class Purchases internal constructor( | |||
} | |||
|
|||
/** | |||
* Make a purchase. | |||
* Make a purchase upgrading from a previous sku. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed these since otherwise these 2 methods with the same name had almost the same documentation.
@@ -10,6 +10,8 @@ import com.revenuecat.purchases.interfaces.ProductChangeListener | |||
private typealias DeprecatedPurchaseCompletedFunction = (purchase: Purchase, purchaserInfo: PurchaserInfo) -> Unit | |||
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
