-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EXTERNAL] Add
ExperimentalPreviewRevenueCatPurchasesAPI
opt-in req…
…uirement to `Purchases.awaitCustomerInfo()` (#1060) <!-- Thank you for contributing to Purchases! Before pressing the "Create Pull Request" button, please provide the following: --> ### Checklist - [ ] If applicable, unit tests - [ ] If applicable, create follow-up issues for `purchases-ios` and hybrids ### Motivation **Why is this change required? What problem does it solve?** Follow up from https://github.com/RevenueCat/purchases-android/pull/1012/files#r1223917692 Instead of only noting that `Purchases.awaitCustomerInfo()` is experimental in the docs (which are often overlooked 😬), we can be more explicit and add an opt-in requirement annotation `ExperimentalPreviewRevenueCatPurchasesAPI`. Capturing from the [Kotlin Opt-in requirements docs](https://kotlinlang.org/docs/opt-in-requirements.html): > The Kotlin standard library provides a mechanism for requiring and giving explicit consent for using certain elements of APIs. This mechanism lets library developers inform users of their APIs about specific conditions that require opt-in, for example, if an API is in the experimental state and is likely to change in the future. > > To prevent potential issues, the compiler warns users of such APIs about these conditions and requires them to opt in before using the API. This opens the door to use this annotation in any other APIs which are experimental, in preview or under cooking, to get initial feedback and iterate "without" breaking SemVer 🚀 <!-- Please link to issues following this format: Resolves #999999 --> ### Description **Describe your changes in detail** - Create `ExperimentalPreviewRevenueCatPurchasesAPI` opt-in requirement annotation - Opt in to using `ExperimentalPreviewRevenueCatPurchasesAPI` wherever `Purchases.awaitCustomerInfo()` is called **Please describe in detail how you tested your changes** - Run `purchases` tests - Run `examples.purchase-test` app cc @tonidero @vegaro
- Loading branch information
1 parent
1be8d36
commit efaaee8
Showing
5 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
public/src/main/java/com/revenuecat/purchases/ExperimentalPreviewRevenueCatPurchasesAPI.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.revenuecat.purchases | ||
|
||
/** | ||
* This annotation marks the experimental preview of the RevenueCat Purchases API. | ||
* This API is in a preview state and has a very high chance of being changed in the future. | ||
* | ||
* Any usage of a declaration annotated with `@ExperimentalPreviewRevenueCatPurchasesAPI` must be | ||
* accepted either by annotating that usage with the [OptIn] annotation, | ||
* e.g. `@OptIn(ExperimentalPreviewRevenueCatPurchasesAPI::class)`, or by using the compiler argument | ||
* `-Xopt-in=kotlin.time.ExperimentalPreviewRevenueCatPurchasesAPI`. | ||
*/ | ||
@Retention(value = AnnotationRetention.BINARY) | ||
@RequiresOptIn(level = RequiresOptIn.Level.ERROR) | ||
@Target( | ||
AnnotationTarget.CLASS, | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY, | ||
) | ||
annotation class ExperimentalPreviewRevenueCatPurchasesAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters