Skip to content
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

Introduces an @InternalRevenueCatAPI annotation #1938

Merged
merged 102 commits into from
Nov 26, 2024
Merged

Conversation

JayShortway
Copy link
Member

In preparation of having to make the Paywalls V2 types public in purchases, so revenuecatui can consume them, this PR adds a new @InternalRevenueCatAPI annotation.

Precedence

There's a lot of precedence for using a @RequiresOptIn annotation to mark a public API as internal. Some examples:

Options considered

I experimented a bit with various ways of marking public APIs as internal, and found that using a @RequiresOptIn annotation is the only one that can actually fail compilation. All of the options below can be worked around by either opting in or suppressing them. However, that is a conscious decision by the developer.

IDE behavior Compiles?
Kotlin Java Kotlin Java
@kotlin.RequiresOptIn red underline red underline
@androidx.annotation.RestrictTo red underline red underline
@androidx.annotation.RequiresOptIn red underline red underline

Also in this PR

  • Applies the annotation to all new Paywalls V2 types. (Types are not yet public.)
  • Opts in module wide in revenuecatui, and for all tests in purchases.

@JayShortway JayShortway requested review from a team November 25, 2024 13:24
@JayShortway JayShortway self-assigned this Nov 25, 2024
AnnotationTarget.PROPERTY,
AnnotationTarget.TYPEALIAS,
)
annotation class InternalRevenueCatAPI
Copy link
Member Author

Choose a reason for hiding this comment

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

Following the Kotlin and Android naming conventions, this would be InternalRevenueCatApi, but I made "API" uppercase for consistency with our existing ExperimentalPreviewRevenueCatPurchasesAPI. Let me know what you think.

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 36.17021% with 30 lines in your changes missing coverage. Please review.

Project coverage is 81.89%. Comparing base (7ca10e0) to head (49a7775).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...t/purchases/paywalls/components/ButtonComponent.kt 33.33% 1 Missing and 3 partials ⚠️
...s/paywalls/components/common/ComponentOverrides.kt 0.00% 0 Missing and 3 partials ⚠️
...at/purchases/paywalls/components/ImageComponent.kt 0.00% 0 Missing and 2 partials ⚠️
...at/purchases/paywalls/components/StackComponent.kt 0.00% 0 Missing and 2 partials ⚠️
...cat/purchases/paywalls/components/TextComponent.kt 0.00% 0 Missing and 2 partials ⚠️
...ses/paywalls/components/common/ComponentsConfig.kt 0.00% 0 Missing and 2 partials ⚠️
...rchases/paywalls/components/common/Localization.kt 33.33% 2 Missing ⚠️
...chases/paywalls/components/properties/ColorInfo.kt 33.33% 0 Missing and 2 partials ⚠️
...chases/paywalls/components/properties/ImageUrls.kt 0.00% 0 Missing and 2 partials ⚠️
.../purchases/paywalls/components/PackageComponent.kt 0.00% 0 Missing and 1 partial ⚠️
... and 8 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1938   +/-   ##
=======================================
  Coverage   81.89%   81.89%           
=======================================
  Files         260      260           
  Lines        8449     8449           
  Branches     1226     1226           
=======================================
  Hits         6919     6919           
  Misses       1032     1032           
  Partials      498      498           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Base automatically changed from pw2-reorg to main November 26, 2024 10:03
# Conflicts:
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/ImageComponent.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/PartialComponent.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/StackComponent.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/TextComponent.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/Background.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/ComponentOverrides.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/ComponentsConfig.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/Localization.kt
#	purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/common/PaywallComponentsData.kt
@JayShortway JayShortway enabled auto-merge (squash) November 26, 2024 10:21
@JayShortway JayShortway merged commit a5375dc into main Nov 26, 2024
10 checks passed
@JayShortway JayShortway deleted the pw2-internal-api branch November 26, 2024 10:41
This was referenced Nov 28, 2024
JayShortway pushed a commit that referenced this pull request Dec 2, 2024
**This is an automatic release.**

## RevenueCat SDK
### 🐞 Bugfixes
* Uses `Sequence` instead of `Stream` to avoid errors due to unavailable
Java 8 APIs (#1943) via JayShortway (@JayShortway)

### 🔄 Other Changes
* Increase integration test timeout (#1946) via Toni Rico (@tonidero)
* Removes `@RequiresApi(N)` from `FileHelper` and related classes
(#1944) via JayShortway (@JayShortway)
* [Paywalls V2] Minimizes Java API (#1942) via JayShortway
(@JayShortway)
* [Paywalls V2] Makes `TextComponent` public (#1939) via JayShortway
(@JayShortway)
* Introduces an `@InternalRevenueCatAPI` annotation (#1938) via
JayShortway (@JayShortway)
* [Paywalls V2] Moves any non-component file to a new `common` package.
(#1937) via JayShortway (@JayShortway)
* [Paywalls V2] `LocalizationKey` is an inline value class now. (#1936)
via JayShortway (@JayShortway)
* [Paywalls V2] Adds `PaywallComponentsData` (#1935) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `StickyFooterComponent` (#1934) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `PurchaseButtonComponent` (#1933) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `PackageComponent` (#1932) via JayShortway
(@JayShortway)
* Ensure the correct error message is shown when failing to open a Uri
in paywalls (#1922) via JayShortway (@JayShortway)
* [Paywalls V2] Adds `ButtonComponent` (#1931) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `StackComponent` (#1930) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `ComponentOverrides` (#1929) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `ImageComponent` (#1928) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `TextComponent` (#1927) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds all enum properties (#1926) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `SizeConstraints`, `Size`, `Padding` and `Shadow`
properties (#1925) via JayShortway (@JayShortway)
* [Paywalls V2] Adds `CornerRadiuses`, `Shape` and `MaskShape`
properties (#1924) via JayShortway (@JayShortway)
* [Paywalls V2] Adds `ImageUrls` and `ColorInfo` properties (#1923) via
JayShortway (@JayShortway)

Co-authored-by: revenuecat-ops <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants